示例#1
0
        public void ShowChooseMainRepositoryPathPopup(EditorWindow context = null)
        {
            var rootProjectPath = paths.ProjectPath;

            var repoPath = EditorUtility.OpenFolderPanel("Repository Path", rootProjectPath, "");

            if (string.IsNullOrEmpty(repoPath))
            {
                return;
            }

            bool isRootPath    = UniGitPathHelper.PathsEqual(repoPath, rootProjectPath);
            bool isChildOfRoot = UniGitPathHelper.IsSubDirectoryOf(repoPath, rootProjectPath);

            if (isRootPath || isChildOfRoot)
            {
                if (isRootPath)
                {
                    EditorPrefs.DeleteKey(UniGitLoader.RepoPathKey);
                }
                else
                {
                    string localPath = repoPath.Replace(rootProjectPath + UniGitPathHelper.UnityDeirectorySeparatorChar, "");
                    EditorPrefs.SetString(UniGitLoader.RepoPathKey, localPath);
                }

                paths.SetRepoPath(repoPath);
                initializer.RecompileSoft();
            }
            else if (context)
            {
                context.ShowNotification(new GUIContent("Invalid Path !"));
            }
        }
示例#2
0
        public void SetRepoPath(string repoPath)
        {
            this.RepoPath = repoPath;

            if (!UniGitPathHelper.PathsEqual(repoPath, ProjectPath))
            {
                RepoProjectRelativePath = UniGitPathHelper.SubtractDirectory(repoPath, ProjectPath);
            }

            SettingsFolderPath  = UniGitPathHelper.Combine(repoPath, ".git", "UniGit");
            SettingsFilePath    = UniGitPathHelper.Combine(SettingsFolderPath, "Settings.json");
            LogsFolderPath      = SettingsFolderPath;
            LogsFilePath        = UniGitPathHelper.Combine(LogsFolderPath, "log.txt");
            CredentialsFilePath = UniGitPathHelper.Combine(SettingsFolderPath, "Credentials.json");
            GitPath             = UniGitPathHelper.Combine(RepoPath, ".git");
        }