diff --git a/GetADoc/MainWindow.xaml.cs b/GetADoc/MainWindow.xaml.cs index 27b8f1f3a04be65dbfea3e357be7682b47a1b2a1..b75d8ff8ed2293615f9c4abf63e779bdaa8e13fb 100644 --- a/GetADoc/MainWindow.xaml.cs +++ b/GetADoc/MainWindow.xaml.cs @@ -148,7 +148,7 @@ namespace GetADoc MessageBoxButton.YesNo, MessageBoxImage.None); if (OverwriteADoc == MessageBoxResult.Yes) { - RunBatch.deleteFolder(filePath, fileName, IconFlag, SepaFlag); + } else if (OverwriteADoc == MessageBoxResult.No) { diff --git a/GetADoc/RunBatch.cs b/GetADoc/RunBatch.cs index 0c0c2b458e6b49cdcbfeb20589ba33c8d39ef298..e6954417ee490f6ff64bcb78aa56a1a53ca9aaf3 100644 --- a/GetADoc/RunBatch.cs +++ b/GetADoc/RunBatch.cs @@ -22,38 +22,10 @@ namespace GetADoc return inFileName; } - //先に同名フォルダが存在すれば削除(エラー回避のため) - public static void deleteFolder(string filePath, string fileName, bool icon, bool sepa) - { - File.Delete(filePath + fileName + ".adoc"); - File.Delete(System.IO.Path.Combine(filePath, "config.adoc")); - if(sepa == true) - { - File.Delete(System.IO.Path.Combine(filePath, "IncDoc.adoc")); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "Images"))) - { - Directory.Delete(System.IO.Path.Combine(filePath, "Images"), true); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "icons")) && icon == true) - { - Directory.Delete(System.IO.Path.Combine(filePath, "icons"), true); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "Sub_First")) && sepa == true) - { - Directory.Delete(System.IO.Path.Combine(filePath, "Sub_First"), true); - } - if (Directory.Exists(System.IO.Path.Combine(filePath, "Sub_Second")) && sepa == true) - { - Directory.Delete(System.IO.Path.Combine(filePath, "Sub_Second"), true); - } - } - //バッチファイルの実行 public static void runBatch(bool icon, bool screen, bool sepa, string fileName, string filePath) { - //テンポラリフォルダの作成 - var tempPath = TemporaryFolder.MakeTempFolder(); + //コンソール呼び出し ProcessStartInfo processStartInfo = new ProcessStartInfo(); @@ -77,7 +49,11 @@ namespace GetADoc { processStartInfo.Arguments += "/SepaDoc "; } - var pathAndName = System.IO.Path.Combine(tempPath, fileName); + + //既存の生成物が指定先フォルダに存在する場合は上書きする + processStartInfo.Arguments += "/Force "; + + var pathAndName = System.IO.Path.Combine(filePath, fileName); processStartInfo.Arguments += pathAndName; //GetADoc.batを実行 @@ -85,11 +61,7 @@ namespace GetADoc process.WaitForExit(); process.Close(); - //指定されたフォルダに生成物を移動 - RunBatch.MoveDirectory(tempPath, filePath); - - //テンポラリフォルダの消去 - TemporaryFolder.DeleteTempFolder(tempPath); + } ///