diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs index 5239a77be..360dab5b7 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/ApplicationCache.cs @@ -21,12 +21,6 @@ public bool FirstRun return val; } } - - [SerializeField] private string createdDate; - public string CreatedDate - { - get { return createdDate; } - } } sealed class EnvironmentCache : ScriptObjectSingleton @@ -83,15 +77,14 @@ public void Flush() } } - [Location("cache/branches.yaml", LocationAttribute.Location.UserFolder)] + [Location("cache/branches.yaml", LocationAttribute.Location.LibraryFolder)] sealed class BranchCache : ScriptObjectSingleton, IBranchCache { [SerializeField] private List localBranches; [SerializeField] private List remoteBranches; - [SerializeField] private List test; + public BranchCache() { - test = new List() { new GitBranch("name", "tracking", false) }; } public List LocalBranches @@ -104,7 +97,6 @@ public List LocalBranches } set { - Logging.GetLogger().Debug("Saving branches {0}", value.Join(",")); localBranches = value; Save(true); } @@ -125,7 +117,7 @@ public List RemoteBranches } } - [Location("views/branches.yaml", LocationAttribute.Location.UserFolder)] + [Location("views/branches.yaml", LocationAttribute.Location.LibraryFolder)] sealed class Favourites : ScriptObjectSingleton { [SerializeField] private List favouriteBranches; @@ -174,4 +166,27 @@ public bool IsFavourite(string branchName) return FavouriteBranches.Contains(branchName); } } + + [Location("cache/gitlog.yaml", LocationAttribute.Location.LibraryFolder)] + sealed class GitLogCache : ScriptObjectSingleton + { + [SerializeField] private List log; + public GitLogCache() + {} + + public List Log + { + get + { + if (log == null) + log = new List(); + return log; + } + set + { + log = value; + Save(true); + } + } + } } diff --git a/src/UnityExtension/Assets/Editor/GitHub.Unity/ScriptObjectSingleton.cs b/src/UnityExtension/Assets/Editor/GitHub.Unity/ScriptObjectSingleton.cs index fcf09c3cd..f6ec083b8 100644 --- a/src/UnityExtension/Assets/Editor/GitHub.Unity/ScriptObjectSingleton.cs +++ b/src/UnityExtension/Assets/Editor/GitHub.Unity/ScriptObjectSingleton.cs @@ -8,7 +8,7 @@ namespace GitHub.Unity [AttributeUsage(AttributeTargets.Class)] class LocationAttribute : Attribute { - public enum Location { PreferencesFolder, ProjectFolder, UserFolder } + public enum Location { PreferencesFolder, ProjectFolder, LibraryFolder, UserFolder } public string filepath { get; set; } public LocationAttribute(string relativePath, Location location) { @@ -21,8 +21,8 @@ public LocationAttribute(string relativePath, Location location) filepath = InternalEditorUtility.unityPreferencesFolder + "/" + relativePath; else if (location == Location.UserFolder) filepath = EntryPoint.Environment.UserCachePath.Combine(relativePath).ToString(SlashMode.Forward); - else - filepath = relativePath; + else if (location == Location.LibraryFolder) + filepath = EntryPoint.Environment.UnityProjectPath.Combine("Library", "gfu", relativePath); } }