From 000916913ea60f60d048b5f2a2f65f424b833435 Mon Sep 17 00:00:00 2001 From: VaDiM Date: Fri, 8 Sep 2023 05:45:27 +0300 Subject: [PATCH] [CLI] Fix a bug where the default output folder might not exist --- AssetStudioCLI/Options/CLIOptions.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/AssetStudioCLI/Options/CLIOptions.cs b/AssetStudioCLI/Options/CLIOptions.cs index cd9a490..28618bb 100644 --- a/AssetStudioCLI/Options/CLIOptions.cs +++ b/AssetStudioCLI/Options/CLIOptions.cs @@ -195,7 +195,7 @@ namespace AssetStudioCLI.Options ); o_outputFolder = new GroupedOption ( - optionDefaultValue: "", + optionDefaultValue: "ASExport", optionName: "-o, --output ", optionDescription: "Specify path to the output folder\n" + "If path isn't specifyed, 'ASExport' folder will be created in the program's work folder\n", @@ -371,7 +371,6 @@ namespace AssetStudioCLI.Options $"Specified file or folder was not found. The input path must be specified as the first argument."); return; } - o_outputFolder.Value = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, $"ASExport{Path.DirectorySeparatorChar}"); } else { @@ -774,6 +773,15 @@ namespace AssetStudioCLI.Options { Studio.assemblyLoader.Loaded = true; } + if (o_outputFolder.Value == o_outputFolder.DefaultValue) + { + var fullPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, o_outputFolder.DefaultValue + Path.DirectorySeparatorChar); + if (!Directory.Exists(fullPath)) + { + Directory.CreateDirectory(fullPath); + } + o_outputFolder.Value = fullPath; + } isParsed = true; }