rename PathEntries.WatchPath etc. to PathEntries.WatchPathFragment to better convey the idea that it isnt a fully-qualified path, so its less likely to get used on accident

This commit is contained in:
zeromus 2013-12-13 05:20:50 +00:00
parent 4b9b11c887
commit 483cf96853
11 changed files with 42 additions and 40 deletions

View File

@ -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;

View File

@ -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<DirectoryInfo>();
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)
{

View File

@ -41,24 +41,24 @@ namespace BizHawk.Client.Common
/// <returns></returns>
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)

View File

@ -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<PathEntry> DefaultValues
{

View File

@ -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);

View File

@ -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, "");

View File

@ -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();

View File

@ -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);

View File

@ -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

View File

@ -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|*.*";

View File

@ -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)
{