public void InitializeRepository(SPath?repositoryPath = null) { SPath expectedRepositoryPath; if (!RepositoryPath.IsInitialized || (repositoryPath != null && RepositoryPath != repositoryPath.Value)) { Guard.NotNull(this, UnityProjectPath, nameof(UnityProjectPath)); expectedRepositoryPath = repositoryPath != null ? repositoryPath.Value : UnityProjectPath.ToSPath(); if (!expectedRepositoryPath.Exists(".git")) { SPath reporoot = UnityProjectPath.ToSPath().RecursiveParents.FirstOrDefault(d => d.Exists(".git")); if (reporoot.IsInitialized) { expectedRepositoryPath = reporoot; } } } else { expectedRepositoryPath = RepositoryPath; } if (expectedRepositoryPath.Exists(".git")) { SPath.FileSystem = new FileSystem(expectedRepositoryPath); RepositoryPath = expectedRepositoryPath; Repository = new Repository(RepositoryPath, CacheContainer); } }
public CreateEnvironmentOptions(NPath?basePath = null) { NPath path = basePath ?? NPath.SystemTemp.Combine(ApplicationInfo.ApplicationName); path.EnsureDirectoryExists(); Extensionfolder = path.Combine(DefaultExtensionFolder); UserProfilePath = path.Combine(DefaultUserProfilePath); UnityProjectPath = path.Combine(DefaultUnityProjectPathAndRepositoryPath); RepositoryPath = path.Combine(DefaultUnityProjectPathAndRepositoryPath); Extensionfolder.EnsureDirectoryExists(); UserProfilePath.EnsureDirectoryExists(); UnityProjectPath.EnsureDirectoryExists(); }