/// <inheritdoc /> public Task MoveFileAsync( string source, string destination, bool replaceExisting = false) { Contract.Requires(!string.IsNullOrEmpty(source)); Contract.Requires(!string.IsNullOrEmpty(destination)); return(Task.Run( () => ExceptionUtilities.HandleRecoverableIOException( () => { if (replaceExisting) { DeleteFile(destination); } m_fileSystem.CreateDirectory(Path.GetDirectoryName(destination)); File.Move(source, destination); }, ex => { throw new BuildXLException(I($"File move from '{source}' to '{destination}' failed"), ex); }))); }
/// <inheritdoc /> public string GetUserSettingsFolder(string appName) { Contract.Requires(!string.IsNullOrEmpty(appName)); var homeFolder = Environment.GetEnvironmentVariable("HOME"); if (string.IsNullOrEmpty(homeFolder)) { throw new BuildXLException("Missing environment variable 'HOME'."); } var settingsFolder = Path.Combine(homeFolder, "." + ToCamelCase(appName)); s_fileSystem.CreateDirectory(settingsFolder); return(settingsFolder); }