diff --git a/BizHawk.Client.Common/CoreFileProvider.cs b/BizHawk.Client.Common/CoreFileProvider.cs index 6bad9fff58..3b9a91f066 100644 --- a/BizHawk.Client.Common/CoreFileProvider.cs +++ b/BizHawk.Client.Common/CoreFileProvider.cs @@ -107,7 +107,7 @@ namespace BizHawk.Client.Common target.SMS_ShowBG = Global.Config.SMSDispBG; target.SMS_ShowOBJ = Global.Config.SMSDispOBJ; - target.PSX_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath, null); // PathManager.MakeAbsolutePath(Global.Config.PathPSXFirmwares, "PSX"); + target.PSX_FirmwaresPath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null); // PathManager.MakeAbsolutePath(Global.Config.PathPSXFirmwares, "PSX"); target.SNES_ShowBG1_0 = Global.Config.SNES_ShowBG1_0; target.SNES_ShowBG1_1 = Global.Config.SNES_ShowBG1_1; diff --git a/BizHawk.Client.Common/FirmwareManager.cs b/BizHawk.Client.Common/FirmwareManager.cs index f551b6c12b..7f648b9bda 100644 --- a/BizHawk.Client.Common/FirmwareManager.cs +++ b/BizHawk.Client.Common/FirmwareManager.cs @@ -89,7 +89,7 @@ namespace BizHawk.Client.Common //build a list of files under the global firmwares path, and build a hash for each of them while we're at it var todo = new Queue(); - todo.Enqueue(new DirectoryInfo(PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath, null))); + todo.Enqueue(new DirectoryInfo(PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null))); while (todo.Count != 0) { diff --git a/BizHawk.Client.Common/PathManager.cs b/BizHawk.Client.Common/PathManager.cs index b5095b1327..9bfedbaac2 100644 --- a/BizHawk.Client.Common/PathManager.cs +++ b/BizHawk.Client.Common/PathManager.cs @@ -41,24 +41,24 @@ namespace BizHawk.Client.Common /// public static string GetBasePathAbsolute() { - if (Global.Config.PathEntries.GlobalBase.Length < 1) //If empty, then EXE path + if (Global.Config.PathEntries.GlobalBaseFragment.Length < 1) //If empty, then EXE path return GetExeDirectoryAbsolute(); - if (Global.Config.PathEntries.GlobalBase.Length >= 5 && - Global.Config.PathEntries.GlobalBase.Substring(0, 5) == "%exe%") + if (Global.Config.PathEntries.GlobalBaseFragment.Length >= 5 && + Global.Config.PathEntries.GlobalBaseFragment.Substring(0, 5) == "%exe%") return GetExeDirectoryAbsolute(); - if (Global.Config.PathEntries.GlobalBase[0] == '.') + if (Global.Config.PathEntries.GlobalBaseFragment[0] == '.') { - if (Global.Config.PathEntries.GlobalBase.Length == 1) + if (Global.Config.PathEntries.GlobalBaseFragment.Length == 1) return GetExeDirectoryAbsolute(); else { - if (Global.Config.PathEntries.GlobalBase.Length == 2 && - Global.Config.PathEntries.GlobalBase == ".\\") + if (Global.Config.PathEntries.GlobalBaseFragment.Length == 2 && + Global.Config.PathEntries.GlobalBaseFragment == ".\\") return GetExeDirectoryAbsolute(); else { - string tmp = Global.Config.PathEntries.GlobalBase; + string tmp = Global.Config.PathEntries.GlobalBaseFragment; tmp = tmp.Remove(0, 1); tmp = tmp.Insert(0, GetExeDirectoryAbsolute()); return tmp; @@ -66,8 +66,8 @@ namespace BizHawk.Client.Common } } - if (Global.Config.PathEntries.GlobalBase.Substring(0, 2) == "..") - return RemoveParents(Global.Config.PathEntries.GlobalBase, GetExeDirectoryAbsolute()); + if (Global.Config.PathEntries.GlobalBaseFragment.Substring(0, 2) == "..") + return RemoveParents(Global.Config.PathEntries.GlobalBaseFragment, GetExeDirectoryAbsolute()); //In case of error, return EXE path return GetExeDirectoryAbsolute(); @@ -80,7 +80,7 @@ namespace BizHawk.Client.Common public static string StandardFirmwareName(string name) { - return Path.Combine(MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath, null), name); + return Path.Combine(MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null), name); } public static string MakeAbsolutePath(string path, string system) @@ -192,7 +192,7 @@ namespace BizHawk.Client.Common public static string GetLuaPath() { - return MakeAbsolutePath(Global.Config.PathEntries.LuaPath, null); + return MakeAbsolutePath(Global.Config.PathEntries.LuaPathFragment, null); } public static string GetRomsPath(string sysID) diff --git a/BizHawk.Client.Common/config/PathEntry.cs b/BizHawk.Client.Common/config/PathEntry.cs index d2559fc189..7dc6428721 100644 --- a/BizHawk.Client.Common/config/PathEntry.cs +++ b/BizHawk.Client.Common/config/PathEntry.cs @@ -100,13 +100,15 @@ namespace BizHawk.Client.Common } //Some frequently requested paths, made into a property for convenience - public string WatchPath { get { return Global.Config.PathEntries["Global", "Watch (.wch)"].Path; } } - public string MoviesPath { get { return Global.Config.PathEntries["Global", "Movies"].Path; } } - public string LuaPath { get { return Global.Config.PathEntries["Global", "Lua"].Path; } } - public string LogPath { get { return Global.Config.PathEntries["Global", "Debug Logs"].Path; } } - public string FirmwaresPath { get { return Global.Config.PathEntries["Global", "Firmware"].Path; } } - public string AvPath { get { return Global.Config.PathEntries["Global", "A/V Dumps"].Path; } } - public string GlobalBase { get { return Global.Config.PathEntries["Global", "Base"].Path; } } + public string WatchPathFragment { get { return Global.Config.PathEntries["Global", "Watch (.wch)"].Path; } } + public string MoviesPathFragment { get { return Global.Config.PathEntries["Global", "Movies"].Path; } } + public string LuaPathFragment { get { return Global.Config.PathEntries["Global", "Lua"].Path; } } + public string LogPathFragment { get { return Global.Config.PathEntries["Global", "Debug Logs"].Path; } } + public string FirmwaresPathFragment { get { return Global.Config.PathEntries["Global", "Firmware"].Path; } } + public string AvPathFragment { get { return Global.Config.PathEntries["Global", "A/V Dumps"].Path; } } + + //this one is special + public string GlobalBaseFragment { get { return Global.Config.PathEntries["Global", "Base"].Path; } } public static List DefaultValues { diff --git a/BizHawk.Client.EmuHawk/MainForm.cs b/BizHawk.Client.EmuHawk/MainForm.cs index ba3cf83959..e24fe3868d 100644 --- a/BizHawk.Client.EmuHawk/MainForm.cs +++ b/BizHawk.Client.EmuHawk/MainForm.cs @@ -2742,12 +2742,12 @@ namespace BizHawk.Client.EmuHawk if (!(Global.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.AvPathFragment, null); } sfd.Filter = String.Format("{0} (*.{0})|*.{0}|All Files|*.*", aw.DesiredExtension()); @@ -3610,7 +3610,7 @@ namespace BizHawk.Client.EmuHawk private static void ProcessMovieImport(string fn) //Nothing Winform Specific here, move to Movie import { - var d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null); + var d = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); string errorMsg; string warningMsg; var m = MovieImport.ImportFile(fn, out errorMsg, out warningMsg); diff --git a/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs b/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs index ff57a97fae..f31a7f2253 100644 --- a/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs +++ b/BizHawk.Client.EmuHawk/config/FirmwaresConfig.cs @@ -81,7 +81,7 @@ namespace BizHawk.Client.EmuHawk listviewSorter = new ListViewSorter(this, -1); - currSelectorDir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath, null); + currSelectorDir = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null); } //makes sure that the specified SystemId is selected in the list (and that all the firmwares for it are visible) @@ -200,7 +200,7 @@ namespace BizHawk.Client.EmuHawk else { //lazy substring extraction. really should do a better job - var basePath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPath, null) + Path.DirectorySeparatorChar; + var basePath = PathManager.MakeAbsolutePath(Global.Config.PathEntries.FirmwaresPathFragment, null) + Path.DirectorySeparatorChar; var path = ri.FilePath.Replace(basePath, ""); diff --git a/BizHawk.Client.EmuHawk/config/PathConfig.cs b/BizHawk.Client.EmuHawk/config/PathConfig.cs index 2557d0915a..32406729aa 100644 --- a/BizHawk.Client.EmuHawk/config/PathConfig.cs +++ b/BizHawk.Client.EmuHawk/config/PathConfig.cs @@ -72,7 +72,7 @@ namespace BizHawk.Client.EmuHawk private void LoadSettings() { RecentForROMs.Checked = Global.Config.UseRecentForROMs; - BasePathBox.Text = Global.Config.PathEntries.GlobalBase; + BasePathBox.Text = Global.Config.PathEntries.GlobalBaseFragment; StartTabPages(); SetDefaultFocusedTab(); diff --git a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs index 8853376e88..b80f26321b 100644 --- a/BizHawk.Client.EmuHawk/movie/PlayMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/PlayMovie.cs @@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk private void BrowseMovies_Click(object sender, EventArgs e) { - var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null) }; + var ofd = new OpenFileDialog { InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) }; var filter = "Movie Files (*." + Global.Config.MovieExtension + ")|*." + Global.Config.MovieExtension + "|Savestates|*.state|All Files|*.*"; ofd.Filter = filter; @@ -275,7 +275,7 @@ namespace BizHawk.Client.EmuHawk { ClearList(); - var directory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null); + var directory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); if (!Directory.Exists(directory)) { Directory.CreateDirectory(directory); diff --git a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs index 421fd111e7..cfa02b5682 100644 --- a/BizHawk.Client.EmuHawk/movie/RecordMovie.cs +++ b/BizHawk.Client.EmuHawk/movie/RecordMovie.cs @@ -36,7 +36,7 @@ namespace BizHawk.Client.EmuHawk { path = path.Insert(0, Path.DirectorySeparatorChar.ToString()); } - path = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null) + path; + path = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null) + path; if (path[path.Length - 4] != '.') //If no file extension, add movie extension { @@ -203,7 +203,7 @@ namespace BizHawk.Client.EmuHawk var filename = String.Empty; var sfd = new SaveFileDialog { - InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null), + InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null), DefaultExt = "." + Global.Config.MovieExtension, FileName = RecordBox.Text, OverwritePrompt = false diff --git a/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs b/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs index 8211ac2734..24fb54ccc0 100644 --- a/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs +++ b/BizHawk.Client.EmuHawk/tools/ToolHelpers.cs @@ -19,7 +19,7 @@ namespace BizHawk.Client.EmuHawk ofd.FileName = Path.GetFileNameWithoutExtension(currentFile); } - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); ofd.Filter = "Tas Project Files (*.tasproj)|*.tasproj|All Files|*.*"; ofd.RestoreDirectory = true; @@ -43,12 +43,12 @@ namespace BizHawk.Client.EmuHawk else if (!(Global.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.MoviesPathFragment, null); } sfd.Filter = "Tas Project Files (*.tasproj)|*.tasproj|All Files|*.*"; @@ -70,7 +70,7 @@ namespace BizHawk.Client.EmuHawk ofd.FileName = Path.GetFileNameWithoutExtension(currentFile); } - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPathFragment, null); ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.RestoreDirectory = true; @@ -94,12 +94,12 @@ namespace BizHawk.Client.EmuHawk else if (!(Global.Emulator is NullEmulator)) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPathFragment, null); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.WatchPathFragment, null); } sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; diff --git a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs index bc0fabe224..e0afd36644 100644 --- a/BizHawk.Client.EmuHawk/tools/TraceLogger.cs +++ b/BizHawk.Client.EmuHawk/tools/TraceLogger.cs @@ -178,7 +178,7 @@ namespace BizHawk.Client.EmuHawk if (_logFile == null) { sfd.FileName = PathManager.FilesystemSafeName(Global.Game) + ".txt"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null); } else if (!String.IsNullOrWhiteSpace(_logFile.FullName)) { @@ -188,7 +188,7 @@ namespace BizHawk.Client.EmuHawk else { sfd.FileName = Path.GetFileNameWithoutExtension(_logFile.FullName); - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null); } sfd.Filter = "Text Files (*.txt)|*.txt|Log Files (*.log)|*.log|All Files|*.*"; @@ -332,7 +332,7 @@ namespace BizHawk.Client.EmuHawk FileBox.Visible = true; BrowseBox.Visible = true; var name = PathManager.FilesystemSafeName(Global.Game); - var filename = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPath, null), name) + ".txt"; + var filename = Path.Combine(PathManager.MakeAbsolutePath(Global.Config.PathEntries.LogPathFragment, null), name) + ".txt"; _logFile = new FileInfo(filename); if (_logFile.Directory != null && !_logFile.Directory.Exists) {