Skip to content

Commit

Permalink
Fix path management jank
Browse files Browse the repository at this point in the history
  • Loading branch information
Norbyte committed Dec 8, 2023
1 parent 76d348c commit f3ba0d2
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
6 changes: 3 additions & 3 deletions ConverterApp/DebugPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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,

Expand Down
2 changes: 1 addition & 1 deletion ConverterApp/VirtualTexturesPane.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion DebuggerFrontend/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
22 changes: 11 additions & 11 deletions LSLib/LS/Mods/ModResources.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<string> goalFiles = [];
Expand All @@ -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);
Expand All @@ -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<string> statFiles = [];
Expand All @@ -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);
Expand All @@ -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<string> globalFiles = [];
Expand All @@ -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);
Expand All @@ -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<string> levelFiles = [];
Expand All @@ -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);
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion LSLib/LS/PackageCommon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -653,7 +653,7 @@ public void UncompressPackage(Package package, string outputPath, Func<AbstractF

if (file.IsDeletion()) continue;

string outPath = outputPath + file.Name;
string outPath = Path.Join(outputPath, file.Name);

FileManager.TryToCreateDirectory(outPath);

Expand Down
4 changes: 2 additions & 2 deletions LSLib/LS/ResourceUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -257,8 +257,8 @@ public void ConvertResources(string inputDir, string outputDir, ResourceFormat i
for (var i = 0; i < paths.Count; i++)
{
var path = paths[i];
var inPath = inputDir + "/" + path;
var outPath = outputDir + "/" + Path.ChangeExtension(path, outputFormat.ToString().ToLower());
var inPath = Path.Join(inputDir, path);
var outPath = Path.Join(outputDir, Path.ChangeExtension(path, outputFormat.ToString().ToLower()));

FileManager.TryToCreateDirectory(outPath);

Expand Down
4 changes: 2 additions & 2 deletions LSLib/VirtualTextures/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,12 +1120,12 @@ public void Build(string dir)
Console.WriteLine($"Raw tile data: {tileBytes / 1024} KB tiles, {embeddedMipBytes / 1024} KB embedded mips, {tileCompressedBytes / 1024} KB transcoded, {pages*Config.PageSize/1024} KB pages total");

OnStepStarted("Saving tile set");
TileSet.Save(dir + "\\" + BuildData.GTSName + ".gts");
TileSet.Save(Path.Join(dir, BuildData.GTSName + ".gts"));

foreach (var file in PageFiles)
{
OnStepStarted($"Saving page file: {file.FileName}");
file.Save(dir + "\\" + file.FileName);
file.Save(Path.Join(dir, file.FileName));
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion LSLib/VirtualTextures/VirtualTexture.cs
Original file line number Diff line number Diff line change
Expand Up @@ -582,7 +582,7 @@ public PageFile GetOrLoadPageFile(int pageFileIdx)
if (!PageFiles.TryGetValue(pageFileIdx, out PageFile file))
{
var meta = PageFileInfos[pageFileIdx];
file = new PageFile(this, PagePath + Path.DirectorySeparatorChar + meta.FileName);
file = new PageFile(this, Path.Join(PagePath, meta.FileName));
PageFiles.Add(pageFileIdx, file);
}

Expand Down

0 comments on commit f3ba0d2

Please sign in to comment.