Path Config - fix some bugs with PathManager functions. Hook up watch file path to Ram Watch dialog

This commit is contained in:
andres.delikat 2011-05-04 15:44:18 +00:00
parent fb6cef87fd
commit a5e092bea3
2 changed files with 21 additions and 3 deletions

View File

@ -38,6 +38,7 @@ namespace BizHawk.MultiClient
string tmp = Global.Config.BasePath; string tmp = Global.Config.BasePath;
tmp = tmp.Remove(0, 1); tmp = tmp.Remove(0, 1);
tmp = tmp.Insert(0, GetExePathAbsolute()); tmp = tmp.Insert(0, GetExePathAbsolute());
return tmp;
} }
} }
} }
@ -90,10 +91,17 @@ namespace BizHawk.MultiClient
if ((path[0] > 'A' && path[0] < 'Z') || (path[0] > 'a' && path[0] < 'z')) if ((path[0] > 'A' && path[0] < 'Z') || (path[0] > 'a' && path[0] < 'z'))
{ {
//C:\
if (path.Length > 2 && path[1] == ':' && path[2] == '\\') if (path.Length > 2 && path[1] == ':' && path[2] == '\\')
return path; return path;
else else
return GetExePathAbsolute(); //bad path {
//file:\ is an acceptable path as well, and what FileBrowserDialog returns
if (path.Length >= 6 && path.Substring(0, 6) == "file:\\")
return path;
else
return GetExePathAbsolute(); //bad path
}
} }
//all pad paths default to EXE //all pad paths default to EXE

View File

@ -586,7 +586,7 @@ namespace BizHawk.MultiClient
var ofd = new OpenFileDialog(); var ofd = new OpenFileDialog();
if (currentWatchFile.Length > 0) if (currentWatchFile.Length > 0)
ofd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); ofd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile);
ofd.InitialDirectory = Global.Config.WatchPath; ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath);
ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; ofd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*";
ofd.RestoreDirectory = true; ofd.RestoreDirectory = true;
@ -632,10 +632,20 @@ namespace BizHawk.MultiClient
{ {
var sfd = new SaveFileDialog(); var sfd = new SaveFileDialog();
if (currentWatchFile.Length > 0) if (currentWatchFile.Length > 0)
{
sfd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile); sfd.FileName = Path.GetFileNameWithoutExtension(currentWatchFile);
sfd.InitialDirectory = Path.GetDirectoryName(currentWatchFile);
}
else if (!(Global.Emulator is NullEmulator)) else if (!(Global.Emulator is NullEmulator))
{
sfd.FileName = Global.Game.Name; sfd.FileName = Global.Game.Name;
sfd.InitialDirectory = Global.Config.WatchPath; sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath);
}
else
{
sfd.FileName = "NULL";
sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.WatchPath);
}
sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*"; sfd.Filter = "Watch Files (*.wch)|*.wch|All Files|*.*";
sfd.RestoreDirectory = true; sfd.RestoreDirectory = true;
Global.Sound.StopSound(); Global.Sound.StopSound();