From 1d111ce0ffbb613e23adfb32d97ed5c08b6586ec Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 12 Mar 2012 04:44:26 +0000 Subject: [PATCH] Use Path.Combine where appropriate --- BizHawk.MultiClient/Config.cs | 92 +++++++++++++++++---------------- BizHawk.MultiClient/MainForm.cs | 4 +- 2 files changed, 49 insertions(+), 47 deletions(-) diff --git a/BizHawk.MultiClient/Config.cs b/BizHawk.MultiClient/Config.cs index 0612086063..2534dc5ecd 100644 --- a/BizHawk.MultiClient/Config.cs +++ b/BizHawk.MultiClient/Config.cs @@ -1,4 +1,6 @@ -namespace BizHawk.MultiClient +using System.IO; + +namespace BizHawk.MultiClient { public class Config { @@ -46,71 +48,71 @@ public string LastRomPath = "."; public string BasePath = "."; - public string BaseNES = ".\\NES"; + public string BaseNES = Path.Combine(".", "NES"); public string PathNESROMs = "."; - public string PathNESSavestates = ".\\State"; - public string PathNESSaveRAM = ".\\SaveRAM"; - public string PathNESScreenshots = ".\\Screenshots"; - public string PathNESCheats = ".\\Cheats"; - public string PathNESPalette = ".\\Palettes"; + public string PathNESSavestates = Path.Combine(".", "State"); + public string PathNESSaveRAM = Path.Combine(".", "SaveRAM"); + public string PathNESScreenshots = Path.Combine(".", "Screenshots"); + public string PathNESCheats = Path.Combine(".", "Cheats"); + public string PathNESPalette = Path.Combine(".", "Palettes"); - public string BaseSMS = ".\\SMS"; + public string BaseSMS = Path.Combine(".", "SMS"); public string PathSMSROMs = "."; - public string PathSMSSavestates = ".\\State"; - public string PathSMSSaveRAM = ".\\SaveRAM"; - public string PathSMSScreenshots = ".\\Screenshots"; - public string PathSMSCheats = ".\\Cheats"; + public string PathSMSSavestates = Path.Combine(".", "State"); + public string PathSMSSaveRAM = Path.Combine(".", "SaveRAM"); + public string PathSMSScreenshots = Path.Combine(".", "Screenshots"); + public string PathSMSCheats = Path.Combine(".", "Cheats"); - public string BaseGG = ".\\Game Gear"; + public string BaseGG = Path.Combine(".", "Game Gear"); public string PathGGROMs = "."; - public string PathGGSavestates = ".\\State"; - public string PathGGSaveRAM = ".\\SaveRAM"; - public string PathGGScreenshots = ".\\Screenshots"; - public string PathGGCheats = ".\\Cheats"; + public string PathGGSavestates = Path.Combine(".", "State"); + public string PathGGSaveRAM = Path.Combine(".", "SaveRAM"); + public string PathGGScreenshots = Path.Combine(".", "Screenshots"); + public string PathGGCheats = Path.Combine(".", "Cheats"); - public string BaseSG = ".\\SG-1000"; + public string BaseSG = Path.Combine(".", "SG-1000"); public string PathSGROMs = "."; - public string PathSGSavestates = ".\\State"; - public string PathSGSaveRAM = ".\\SaveRAM"; - public string PathSGScreenshots = ".\\Screenshots"; - public string PathSGCheats = ".\\Cheats"; + public string PathSGSavestates = Path.Combine(".", "State"); + public string PathSGSaveRAM = Path.Combine(".", "SaveRAM"); + public string PathSGScreenshots = Path.Combine(".", "Screenshots"); + public string PathSGCheats = Path.Combine(".", "Cheats"); - public string BaseGenesis = ".\\Genesis"; + public string BaseGenesis = Path.Combine(".", "Genesis"); public string PathGenesisROMs = "."; - public string PathGenesisSavestates = ".\\State"; - public string PathGenesisSaveRAM = ".\\SaveRAM"; - public string PathGenesisScreenshots = ".\\Screenshots"; - public string PathGenesisCheats = ".\\Cheats"; + public string PathGenesisSavestates = Path.Combine(".", "State"); + public string PathGenesisSaveRAM = Path.Combine(".", "SaveRAM"); + public string PathGenesisScreenshots = Path.Combine(".", "Screenshots"); + public string PathGenesisCheats = Path.Combine(".", "Cheats"); - public string BasePCE = ".\\PC Engine"; + public string BasePCE = Path.Combine(".", "PC Engine"); public string PathPCEROMs = "."; - public string PathPCESavestates = ".\\State"; - public string PathPCESaveRAM = ".\\SaveRAM"; - public string PathPCEScreenshots = ".\\Screenshots"; - public string PathPCECheats = ".\\Cheats"; + public string PathPCESavestates = Path.Combine(".", "State"); + public string PathPCESaveRAM = Path.Combine(".", "SaveRAM"); + public string PathPCEScreenshots = Path.Combine(".", "Screenshots"); + public string PathPCECheats = Path.Combine(".", "Cheats"); - public string BaseGameboy = ".\\Gameboy"; + public string BaseGameboy = Path.Combine(".", "Gameboy"); public string PathGBROMs = "."; - public string PathGBSavestates = ".\\State"; - public string PathGBSaveRAM = ".\\SaveRAM"; - public string PathGBScreenshots = ".\\Screenshots"; - public string PathGBCheats = ".\\Cheats"; + public string PathGBSavestates = Path.Combine(".", "State"); + public string PathGBSaveRAM = Path.Combine(".", "SaveRAM"); + public string PathGBScreenshots = Path.Combine(".", "Screenshots"); + public string PathGBCheats = Path.Combine(".", "Cheats"); - public string BaseTI83 = ".\\TI83"; + public string BaseTI83 = Path.Combine(".", "TI83"); public string PathTI83ROMs = "."; - public string PathTI83Savestates = ".\\State"; - public string PathTI83SaveRAM = ".\\SaveRAM"; - public string PathTI83Screenshots = ".\\Screenshots"; - public string PathTI83Cheats = ".\\Cheats"; + public string PathTI83Savestates = Path.Combine(".", "State"); + public string PathTI83SaveRAM = Path.Combine(".", "SaveRAM"); + public string PathTI83Screenshots = Path.Combine(".", "Screenshots"); + public string PathTI83Cheats = Path.Combine(".", "Cheats"); - public string MoviesPath = ".\\Movies"; - public string LuaPath = ".\\Lua"; + public string MoviesPath = Path.Combine(".", "Movies"); + public string LuaPath = Path.Combine(".", "Lua"); public string WatchPath = "."; public string AVIPath = "."; //BIOS Paths - public string PathPCEBios = ".\\PCECDBios.pce"; //TODO: better default filename + public string PathPCEBios = Path.Combine(".", "PCECDBios.pce"); //TODO: better default filename public string FFMpegPath = "%exe%/ffmpeg.exe"; diff --git a/BizHawk.MultiClient/MainForm.cs b/BizHawk.MultiClient/MainForm.cs index d96487fa56..172e7c0889 100644 --- a/BizHawk.MultiClient/MainForm.cs +++ b/BizHawk.MultiClient/MainForm.cs @@ -91,7 +91,7 @@ namespace BizHawk.MultiClient //we could background thread this later instead if we wanted to be real clever NES.BootGodDB.GetDatabaseBytes = () => { - using (HawkFile NesCartFile = new HawkFile(PathManager.GetExeDirectoryAbsolute() + "\\NesCarts.7z").BindFirst()) + using (HawkFile NesCartFile = new HawkFile(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "NesCarts.7z")).BindFirst()) return Util.ReadAllBytes(NesCartFile.GetStream()); }; Global.MainForm = this; @@ -104,7 +104,7 @@ namespace BizHawk.MultiClient Console.WriteLine("{0} - {1} ({2})", ci.FriendlyName, ci.Version, ci.ClassName); } - Database.LoadDatabase(PathManager.GetExeDirectoryAbsolute() + "\\gamedb.txt"); + Database.LoadDatabase(Path.Combine(PathManager.GetExeDirectoryAbsolute(), "gamedb.txt")); SyncPresentationMode();