diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Converter.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Converter.cs index f362920..772dd8d 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Converter.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Converter.cs @@ -296,18 +296,14 @@ public static void ConvertTextureFromDdsToOthers(string? sourceFilePath, string if (fixesDdsToGeneric) options.outputSwizzle = new() { mask = "abgr" }; - Console.WriteLine("EXEC1"); TexconvApp.RunTexconv(sourceFilePath, options); - Console.WriteLine("OUT1"); } else if (d3dtxTextureType == D3DTX_Converter.TelltaleEnums.T3TextureType.eTxNormalXYMap) { - Console.WriteLine("EXEC2"); if (fixesDdsToGeneric) NormalMapProcessing.FromDDS_NormalMapReconstructZ(sourceFilePath, outputTextureFilePath); else - NormalMapConvert.ConvertNormalMapToOthers(sourceFilePath, newFileType); //lol - Console.WriteLine("OUT2"); + NormalMapConvert.ConvertNormalMapToOthers(sourceFilePath, newFileType); } else { diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Texconv/TexconvApp.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Texconv/TexconvApp.cs index 0aebbf0..3c73bf7 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Texconv/TexconvApp.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/Texconv/TexconvApp.cs @@ -18,11 +18,12 @@ public static void RunTexconv(string inputFilePath, MasterOptions options) string texconvApplicationDirectoryPath = Path.Combine(solutionDir, "ExternalDependencies", "texconv.exe"); ProcessStartInfo textconvProcessStartInfo = new(); + textconvProcessStartInfo.CreateNoWindow = true; // Check if the current OS is Linux if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { - // If it's not Linux, run the .exe file directly + // If it's not Unix-based OS, run the .exe file directly textconvProcessStartInfo.FileName = texconvApplicationDirectoryPath; textconvProcessStartInfo.Arguments = options.GetArguments(inputFilePath); } @@ -31,10 +32,8 @@ public static void RunTexconv(string inputFilePath, MasterOptions options) // If it's Linux or OSX, use Wine to run the .exe file textconvProcessStartInfo.FileName = "wine"; textconvProcessStartInfo.Arguments = $"{texconvApplicationDirectoryPath} {options.GetArguments(inputFilePath)}"; - - } - textconvProcessStartInfo.CreateNoWindow = true; + } Process texconvProcess = new(); texconvProcess.StartInfo = textconvProcessStartInfo; diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/MasterOptions.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/MasterOptions.cs index 0d6b2e2..f115eae 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/MasterOptions.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/MasterOptions.cs @@ -65,6 +65,11 @@ public string GetArguments(string inputFilePath) { List arguments = new(); + if (inputFilePath.Contains(" ")) + { + inputFilePath = $"\"{inputFilePath}\""; + } + arguments.Add(inputFilePath); arguments.Add("-r"); diff --git a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/OutputDirectory.cs b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/OutputDirectory.cs index 5e11c50..259618c 100644 --- a/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/OutputDirectory.cs +++ b/DDS_D3DTX_Converter_GUI/DDS_D3DTX_Converter/TexconvOptions/OutputDirectory.cs @@ -7,6 +7,16 @@ public class OutputDirectory { public string directory; - public string GetArgumentOutput() => string.Format("-o {0}", directory); + public string GetArgumentOutput() + { + if (directory.Contains(" ")) + { + return string.Format("-o \"{0}\"", directory); + } + else + { + return string.Format("-o {0}", directory); + } + } } }