From f3ba0d2c9ab491c6abbd2074c4d69c3d29a43330 Mon Sep 17 00:00:00 2001 From: Norbyte Date: Fri, 8 Dec 2023 23:30:38 +0100 Subject: [PATCH] Fix path management jank --- ConverterApp/DebugPane.cs | 6 +++--- ConverterApp/VirtualTexturesPane.cs | 2 +- DebuggerFrontend/Program.cs | 2 +- LSLib/LS/Mods/ModResources.cs | 22 +++++++++++----------- LSLib/LS/PackageCommon.cs | 2 +- LSLib/LS/ResourceUtils.cs | 4 ++-- LSLib/VirtualTextures/Build.cs | 4 ++-- LSLib/VirtualTextures/VirtualTexture.cs | 2 +- 8 files changed, 22 insertions(+), 22 deletions(-) diff --git a/ConverterApp/DebugPane.cs b/ConverterApp/DebugPane.cs index a3ff866a..40ce6689 100644 --- a/ConverterApp/DebugPane.cs +++ b/ConverterApp/DebugPane.cs @@ -19,13 +19,13 @@ public DebugPane(ISettingsDataSource settingsDataSource) private DebugDumperTask CreateDumperFromSettings() { - string dumpPath = Path.GetDirectoryName(saveFilePath.Text) + "\\" + Path.GetFileNameWithoutExtension(saveFilePath.Text) + "\\"; + string dumpPath = Path.Join(Path.GetDirectoryName(saveFilePath.Text), Path.GetFileNameWithoutExtension(saveFilePath.Text)); var dumper = new DebugDumperTask { GameVersion = Game, - ExtractionPath = dumpPath + "SaveArchive", - DataDumpPath = dumpPath + "Dumps", + ExtractionPath = Path.Join(dumpPath, "SaveArchive"), + DataDumpPath = Path.Join(dumpPath, "Dumps"), SaveFilePath = saveFilePath.Text, diff --git a/ConverterApp/VirtualTexturesPane.cs b/ConverterApp/VirtualTexturesPane.cs index 0782e3a5..7d6e88ab 100644 --- a/ConverterApp/VirtualTexturesPane.cs +++ b/ConverterApp/VirtualTexturesPane.cs @@ -60,7 +60,7 @@ private void extractTileSetBtn_Click(object sender, EventArgs e) if (tex != null) { - var outputPath = destinationPath.Text + Path.PathSeparator + texture.Name + $"_{layer}.dds"; + var outputPath = Path.Join(destinationPath.Text, texture.Name + $"_{layer}.dds"); tex.SaveDDS(outputPath); } } diff --git a/DebuggerFrontend/Program.cs b/DebuggerFrontend/Program.cs index 2f2c6f27..2a540860 100644 --- a/DebuggerFrontend/Program.cs +++ b/DebuggerFrontend/Program.cs @@ -13,7 +13,7 @@ class Program static void Main(string[] args) { var currentPath = AppDomain.CurrentDomain.BaseDirectory; - var logFile = new FileStream(currentPath + "\\DAP.log", FileMode.Create); + var logFile = new FileStream(Path.Join(currentPath, "DAP.log"), FileMode.Create); var dap = new DAPStream(); dap.EnableLogging(logFile); var dapHandler = new DAPMessageHandler(dap); diff --git a/LSLib/LS/Mods/ModResources.cs b/LSLib/LS/Mods/ModResources.cs index f4fb4af3..b35aad95 100644 --- a/LSLib/LS/Mods/ModResources.cs +++ b/LSLib/LS/Mods/ModResources.cs @@ -336,7 +336,7 @@ public void DiscoverUserPackages(string gameDataPath) private void DiscoverModGoals(string modName, string modPath) { - var goalPath = modPath + @"\Story\RawFiles\Goals"; + var goalPath = Path.Join(modPath, @"Story\RawFiles\Goals"); if (!Directory.Exists(goalPath)) return; List goalFiles = []; @@ -346,7 +346,7 @@ private void DiscoverModGoals(string modName, string modPath) { var fileInfo = new FilesystemFileInfo { - FilesystemPath = goalPath + "\\" + goalFile, + FilesystemPath = Path.Join(goalPath, goalFile), Name = goalFile }; AddScriptToMod(modName, goalFile, fileInfo); @@ -355,7 +355,7 @@ private void DiscoverModGoals(string modName, string modPath) private void DiscoverModStats(string modName, string modPublicPath) { - var statsPath = modPublicPath + @"\Stats\Generated\Data"; + var statsPath = Path.Join(modPublicPath, @"Stats\Generated\Data"); if (!Directory.Exists(statsPath)) return; List statFiles = []; @@ -365,7 +365,7 @@ private void DiscoverModStats(string modName, string modPublicPath) { var fileInfo = new FilesystemFileInfo { - FilesystemPath = statsPath + "\\" + statFile, + FilesystemPath = Path.Join(statsPath, statFile), Name = statFile }; AddStatToMod(modName, statFile, fileInfo); @@ -374,7 +374,7 @@ private void DiscoverModStats(string modName, string modPublicPath) private void DiscoverModGlobals(string modName, string modPath) { - var globalsPath = modPath + @"\Globals"; + var globalsPath = Path.Join(modPath, "Globals"); if (!Directory.Exists(globalsPath)) return; List globalFiles = []; @@ -384,7 +384,7 @@ private void DiscoverModGlobals(string modName, string modPath) { var fileInfo = new FilesystemFileInfo { - FilesystemPath = globalsPath + "\\" + globalFile, + FilesystemPath = Path.Join(globalsPath, globalFile), Name = globalFile }; AddGlobalsToMod(modName, globalFile, fileInfo); @@ -393,7 +393,7 @@ private void DiscoverModGlobals(string modName, string modPath) private void DiscoverModLevelObjects(string modName, string modPath) { - var levelsPath = modPath + @"\Levels"; + var levelsPath = Path.Join(modPath, "Levels"); if (!Directory.Exists(levelsPath)) return; List levelFiles = []; @@ -404,7 +404,7 @@ private void DiscoverModLevelObjects(string modName, string modPath) { var fileInfo = new FilesystemFileInfo { - FilesystemPath = levelsPath + "\\" + levelFile, + FilesystemPath = Path.Join(levelsPath, levelFile), Name = levelFile }; AddLevelObjectsToMod(modName, levelFile, fileInfo); @@ -420,7 +420,7 @@ public void DiscoverModDirectory(string modName, string modPath, string publicPa { DiscoverModGoals(modName, modPath); - var headerPath = modPath + @"\Story\RawFiles\story_header.div"; + var headerPath = Path.Join(modPath, @"Story\RawFiles\story_header.div"); if (File.Exists(headerPath)) { var fileInfo = new FilesystemFileInfo @@ -431,7 +431,7 @@ public void DiscoverModDirectory(string modName, string modPath, string publicPa GetMod(modName).StoryHeaderFile = fileInfo; } - var orphanQueryIgnoresPath = modPath + @"\Story\story_orphanqueries_ignore_local.txt"; + var orphanQueryIgnoresPath = Path.Join(modPath, @"Story\story_orphanqueries_ignore_local.txt"); if (File.Exists(orphanQueryIgnoresPath)) { var fileInfo = new FilesystemFileInfo @@ -442,7 +442,7 @@ public void DiscoverModDirectory(string modName, string modPath, string publicPa GetMod(modName).OrphanQueryIgnoreList = fileInfo; } - var typeCoercionWhitelistPath = modPath + @"\Story\RawFiles\TypeCoercionWhitelist.txt"; + var typeCoercionWhitelistPath = Path.Join(modPath, @"Story\RawFiles\TypeCoercionWhitelist.txt"); if (File.Exists(typeCoercionWhitelistPath)) { var fileInfo = new FilesystemFileInfo diff --git a/LSLib/LS/PackageCommon.cs b/LSLib/LS/PackageCommon.cs index ba701226..17bf4ea8 100644 --- a/LSLib/LS/PackageCommon.cs +++ b/LSLib/LS/PackageCommon.cs @@ -653,7 +653,7 @@ public void UncompressPackage(Package package, string outputPath, Func