Cheats - fix up open and save file dialog file/directory logic
This commit is contained in:
parent
3d28d0dc5d
commit
df2dd2df9b
|
@ -108,15 +108,15 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public static FileInfo GetCheatFileFromUser(string currentFile)
|
public static FileInfo GetCheatFileFromUser(string currentFile)
|
||||||
{
|
{
|
||||||
var ofd = new OpenFileDialog();
|
var ofd = new OpenFileDialog
|
||||||
if (!string.IsNullOrWhiteSpace(currentFile))
|
|
||||||
{
|
{
|
||||||
ofd.FileName = Path.GetFileNameWithoutExtension(currentFile);
|
FileName = !string.IsNullOrWhiteSpace(currentFile)
|
||||||
}
|
? Path.GetFileNameWithoutExtension(currentFile)
|
||||||
|
: PathManager.FilesystemSafeName(Global.Game),
|
||||||
ofd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
|
InitialDirectory = PathManager.GetCheatsPath(Global.Game),
|
||||||
ofd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
|
Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*",
|
||||||
ofd.RestoreDirectory = true;
|
RestoreDirectory = true
|
||||||
|
};
|
||||||
|
|
||||||
var result = ofd.ShowHawkDialog();
|
var result = ofd.ShowHawkDialog();
|
||||||
if (result != DialogResult.OK)
|
if (result != DialogResult.OK)
|
||||||
|
@ -129,15 +129,22 @@ namespace BizHawk.Client.EmuHawk
|
||||||
|
|
||||||
public static FileInfo GetCheatSaveFileFromUser(string currentFile)
|
public static FileInfo GetCheatSaveFileFromUser(string currentFile)
|
||||||
{
|
{
|
||||||
var sfd = new SaveFileDialog();
|
var cheatsPath = PathManager.GetCheatsPath(Global.Game);
|
||||||
if (!string.IsNullOrWhiteSpace(currentFile))
|
if (!Directory.Exists(cheatsPath))
|
||||||
{
|
{
|
||||||
sfd.FileName = Path.GetFileNameWithoutExtension(currentFile);
|
Directory.CreateDirectory(cheatsPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
sfd.InitialDirectory = PathManager.GetCheatsPath(Global.Game);
|
var sfd = new SaveFileDialog
|
||||||
sfd.Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*";
|
{
|
||||||
sfd.RestoreDirectory = true;
|
Filter = "Cheat Files (*.cht)|*.cht|All Files|*.*",
|
||||||
|
RestoreDirectory = true,
|
||||||
|
InitialDirectory = cheatsPath,
|
||||||
|
FileName = !string.IsNullOrWhiteSpace(currentFile)
|
||||||
|
? Path.GetFileNameWithoutExtension(currentFile)
|
||||||
|
: PathManager.FilesystemSafeName(Global.Game)
|
||||||
|
};
|
||||||
|
|
||||||
var result = sfd.ShowHawkDialog();
|
var result = sfd.ShowHawkDialog();
|
||||||
if (result != DialogResult.OK)
|
if (result != DialogResult.OK)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue