From dab3df8ea29fee16a05ee4bdf33e6a97334ad5f7 Mon Sep 17 00:00:00 2001 From: "andres.delikat" Date: Sat, 7 May 2011 19:14:52 +0000 Subject: [PATCH] Path Config stuff --- BizHawk.MultiClient/PlayMovie.cs | 2 +- BizHawk.MultiClient/config/PathConfig.cs | 3 +-- BizHawk.MultiClient/config/PathManager.cs | 19 +++++++++++++------ BizHawk.MultiClient/tools/RamSearch.cs | 6 +++--- BizHawk.MultiClient/tools/RamWatch.cs | 6 +++--- 5 files changed, 21 insertions(+), 15 deletions(-) diff --git a/BizHawk.MultiClient/PlayMovie.cs b/BizHawk.MultiClient/PlayMovie.cs index a776e53384..235de91977 100644 --- a/BizHawk.MultiClient/PlayMovie.cs +++ b/BizHawk.MultiClient/PlayMovie.cs @@ -32,7 +32,7 @@ namespace BizHawk.MultiClient private void BrowseMovies_Click(object sender, EventArgs e) { OpenFileDialog o = new OpenFileDialog(); - o.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath); + o.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.MoviesPath, ""); if (o.ShowDialog() == DialogResult.OK) { diff --git a/BizHawk.MultiClient/config/PathConfig.cs b/BizHawk.MultiClient/config/PathConfig.cs index ebedf27f69..8d50f9667c 100644 --- a/BizHawk.MultiClient/config/PathConfig.cs +++ b/BizHawk.MultiClient/config/PathConfig.cs @@ -159,8 +159,7 @@ namespace BizHawk.MultiClient { FolderBrowserDialog f = new FolderBrowserDialog(); f.Description = "Set the directory for " + Name; - //f.SelectedPath = PathManager.MakeAbsolutePath(box.Text, System); - f.SelectedPath = Global.Config.LastRomPath; + f.SelectedPath = PathManager.MakeAbsolutePath(box.Text, System); DialogResult result = f.ShowDialog(); if (result == DialogResult.OK) box.Text = f.SelectedPath; diff --git a/BizHawk.MultiClient/config/PathManager.cs b/BizHawk.MultiClient/config/PathManager.cs index 2f02a81c9d..5c84612352 100644 --- a/BizHawk.MultiClient/config/PathManager.cs +++ b/BizHawk.MultiClient/config/PathManager.cs @@ -100,16 +100,23 @@ namespace BizHawk.MultiClient if (path[0] == '.') { - string tmp = path; - tmp = tmp.Remove(0, 1); - tmp = tmp.Insert(0, GetPlatformBase(system)); + if (system.Length > 0) + { + + path = path.Remove(0, 1); + path = path.Insert(0, GetPlatformBase(system)); + } if (path.Length == 1) return GetBasePathAbsolute(); else { - tmp = path.Remove(0, 1); - tmp = tmp.Insert(0, GetBasePathAbsolute()); - return tmp; + if (path[0] == '.') + { + path = path.Remove(0, 1); + path = path.Insert(0, GetBasePathAbsolute()); + } + + return path; } } diff --git a/BizHawk.MultiClient/tools/RamSearch.cs b/BizHawk.MultiClient/tools/RamSearch.cs index 8b159f72a6..1096fc3eb8 100644 --- a/BizHawk.MultiClient/tools/RamSearch.cs +++ b/BizHawk.MultiClient/tools/RamSearch.cs @@ -1241,12 +1241,12 @@ namespace BizHawk.MultiClient else if (!(Global.Emulator is NullEmulator)) { sfd.FileName = Global.Game.Name; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); } sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; sfd.RestoreDirectory = true; @@ -1438,7 +1438,7 @@ namespace BizHawk.MultiClient var ofd = new OpenFileDialog(); if (currentSearchFile.Length > 0) ofd.FileName = Path.GetFileNameWithoutExtension(currentSearchFile); - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.RestoreDirectory = true; if (currentSearchFile.Length > 0) diff --git a/BizHawk.MultiClient/tools/RamWatch.cs b/BizHawk.MultiClient/tools/RamWatch.cs index 80e56ee1d4..23178a4256 100644 --- a/BizHawk.MultiClient/tools/RamWatch.cs +++ b/BizHawk.MultiClient/tools/RamWatch.cs @@ -586,7 +586,7 @@ namespace BizHawk.MultiClient var ofd = new OpenFileDialog(); if (currentWatchFile.Length > 0) ofd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); - ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.RestoreDirectory = true; @@ -638,12 +638,12 @@ namespace BizHawk.MultiClient else if (!(Global.Emulator is NullEmulator)) { sfd.FileName = Global.Game.Name; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); } else { sfd.FileName = "NULL"; - sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath); + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath, ""); } sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; sfd.RestoreDirectory = true;