protected string ValidateAndGetOutputPath(CommonCommandLineModel commandLineModel, string outputFileName) { string outputFolder = String.IsNullOrEmpty(commandLineModel.RelativeFolderPath) ? ApplicationEnvironment.ApplicationBasePath : Path.Combine(ApplicationEnvironment.ApplicationBasePath, commandLineModel.RelativeFolderPath); var outputPath = Path.Combine(outputFolder, outputFileName); if (File.Exists(outputPath) && !commandLineModel.Force) { throw new InvalidOperationException(string.Format( CultureInfo.CurrentCulture, "The file {0} exists, use -f option to overwrite", outputPath)); } return outputPath; }
protected string ValidateAndGetOutputPath(CommonCommandLineModel commandLineModel, string outputFileName) { string outputFolder = String.IsNullOrEmpty(commandLineModel.RelativeFolderPath) ? ApplicationEnvironment.ApplicationBasePath : Path.Combine(ApplicationEnvironment.ApplicationBasePath, commandLineModel.RelativeFolderPath); var outputPath = Path.Combine(outputFolder, outputFileName); if (File.Exists(outputPath) && !commandLineModel.Force) { throw new InvalidOperationException(string.Format( CultureInfo.CurrentCulture, "The file {0} exists, use -f option to overwrite", outputPath)); } return(outputPath); }
protected string ValidateAndGetOutputPath(CommonCommandLineModel commandLineModel, string outputFileName) { string outputFolder = String.IsNullOrEmpty(commandLineModel.RelativeFolderPath) ? ApplicationInfo.ApplicationBasePath : Path.Combine(ApplicationInfo.ApplicationBasePath, commandLineModel.RelativeFolderPath); var outputPath = Path.Combine(outputFolder, outputFileName); if (File.Exists(outputPath) && !commandLineModel.Force) { throw new InvalidOperationException(string.Format( CultureInfo.CurrentCulture, MessageStrings.FileExists_useforce, outputPath)); } return(outputPath); }