public DefaultEnvironment() { if (IsWindows) { LocalAppData = GetSpecialFolder(Environment.SpecialFolder.LocalApplicationData).ToNPath(); CommonAppData = GetSpecialFolder(Environment.SpecialFolder.CommonApplicationData).ToNPath(); } else if (IsMac) { LocalAppData = NPath.HomeDirectory.Combine("Library", "Application Support"); // there is no such thing on the mac that is guaranteed to be user accessible (/usr/local might not be) CommonAppData = GetSpecialFolder(Environment.SpecialFolder.ApplicationData).ToNPath(); } else { LocalAppData = GetSpecialFolder(Environment.SpecialFolder.LocalApplicationData).ToNPath(); CommonAppData = GetSpecialFolder(Environment.SpecialFolder.ApplicationData).ToNPath(); } UserCachePath = LocalAppData.Combine(ApplicationInfo.ApplicationName); SystemCachePath = CommonAppData.Combine(ApplicationInfo.ApplicationName); if (IsMac) { LogPath = NPath.HomeDirectory.Combine("Library/Logs").Combine(ApplicationInfo.ApplicationName).Combine(logFile); } else { LogPath = UserCachePath.Combine(logFile); } LogPath.EnsureParentDirectoryExists(); GitDefaultInstallation = new GitInstaller.GitInstallDetails(UserCachePath, this); }
public IntegrationTestEnvironment(ICacheContainer cacheContainer, NPath repoPath, NPath solutionDirectory, CreateEnvironmentOptions options = null, bool enableTrace = false, bool initializeRepository = true) { this.enableTrace = enableTrace; options = options ?? new CreateEnvironmentOptions(NPath.SystemTemp.Combine(ApplicationInfo.ApplicationName, "IntegrationTests")); defaultEnvironment = new DefaultEnvironment(cacheContainer); defaultEnvironment.FileSystem.SetCurrentDirectory(repoPath); var environmentPath = options.UserProfilePath; LocalAppData = environmentPath.Combine("User"); UserCachePath = LocalAppData.Combine("Cache"); CommonAppData = environmentPath.Combine("System"); SystemCachePath = CommonAppData.Combine("Cache"); var installPath = solutionDirectory.Parent.Parent.Parent.Combine("src", "com.unity.git.api", "Api"); Initialize(UnityVersion, installPath, solutionDirectory, NPath.Default, repoPath.Combine("Assets")); InitializeRepository(initializeRepository ? (NPath?)repoPath : null); GitDefaultInstallation = new GitInstaller.GitInstallDetails(UserCachePath, this); if (enableTrace) { logger.Trace("EnvironmentPath: \"{0}\" SolutionDirectory: \"{1}\" ExtensionInstallPath: \"{2}\"", environmentPath, solutionDirectory, ExtensionInstallPath); } }
public UnityEnvironment(string applicationName, string logFile = DefaultLogFilename) { ApplicationName = applicationName; LocalAppData = GetFolder(Folders.LocalApplicationData); CommonAppData = GetFolder(Folders.CommonApplicationData); UserCachePath = LocalAppData.Combine(ApplicationName); SystemCachePath = CommonAppData.Combine(ApplicationName); LogPath = GetFolder(Folders.Logs).Combine(ApplicationName, logFile); }
public ApplicationEnvironment(string applicationName = null) : base(applicationName ?? ApplicationInfo.ApplicationName) { LocalAppData = GetFolder(Folders.LocalApplicationData); CommonAppData = GetFolder(Folders.CommonApplicationData); UserCachePath = LocalAppData.Combine(ApplicationName).EnsureDirectoryExists(); SystemCachePath = CommonAppData.Combine(ApplicationName).EnsureDirectoryExists(); LogPath = GetFolder(Folders.Logs).Combine(ApplicationName).EnsureDirectoryExists().Combine(logFile); GitDefaultInstallation = new GitInstaller.GitInstallDetails(UserCachePath, this); }
public IntegrationTestEnvironment(SPath testPath, SPath sharedTestPath, string applicationName) { Guard.ArgumentNotNull(applicationName, nameof(applicationName)); ApplicationName = applicationName; this.sharedTestEnvironmentPath = sharedTestPath.Combine("git-unity-test-environment").EnsureDirectoryExists(); this.testPath = testPath.Combine("SystemData").EnsureDirectoryExists(); LocalAppData = GetFolder(Folders.LocalApplicationData); CommonAppData = GetFolder(Folders.CommonApplicationData); UserCachePath = LocalAppData.Combine(applicationName).EnsureDirectoryExists(); SystemCachePath = CommonAppData.Combine(applicationName).EnsureDirectoryExists(); LogPath = GetFolder(Folders.Logs).Combine(applicationName).EnsureDirectoryExists().Combine(logFile); GitDefaultInstallation = new GitInstaller.GitInstallDetails(sharedTestEnvironmentPath, this); }