void TrySaveFile(string projectRootFolder, CsharpProjectFileToSave file) { var filename = Path.Combine(projectRootFolder, file.PathRelativeToProjectRoot); Directory.CreateDirectory(Path.GetDirectoryName(filename)); var overrideFilename = Path.GetDirectoryName(filename) + "\\" + Path.GetFileNameWithoutExtension(filename) + "Override" + Path.GetExtension(filename); if (File.Exists(overrideFilename)) { if (File.Exists(filename)) { File.Delete(filename); } File.WriteAllText( filename + ".txt", file.Content); } else { File.WriteAllText( filename, file.Content); } }
void SaveFile(string projectRootFolder, CsharpProjectFileToSave file) { try { TrySaveFile(projectRootFolder, file); } catch (Exception exception) { logger.LogFileSaveError(projectRootFolder, exception); } }