From a334e069a2ef8798da682c08426a1519b05ce346 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sun, 16 Sep 2012 02:12:25 +0000 Subject: [PATCH] GB Palette Config - fix usage of palette path in save/open file dialogs, use a default name based on game name for save when there is no palette file instead of crashing --- BizHawk.MultiClient/GBtools/ColorChooserForm.cs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/BizHawk.MultiClient/GBtools/ColorChooserForm.cs b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs index 8509b2ef1b..f648c7d1d7 100644 --- a/BizHawk.MultiClient/GBtools/ColorChooserForm.cs +++ b/BizHawk.MultiClient/GBtools/ColorChooserForm.cs @@ -312,7 +312,7 @@ namespace BizHawk.MultiClient.GBtools { using (var ofd = new OpenFileDialog()) { - ofd.InitialDirectory = Global.Config.PathGBPalettes; + ofd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathGBPalettes, "GB"); ofd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*"; ofd.RestoreDirectory = true; @@ -348,11 +348,18 @@ namespace BizHawk.MultiClient.GBtools { using (var sfd = new SaveFileDialog()) { - sfd.InitialDirectory = Path.GetDirectoryName(currentfile); + if (!String.IsNullOrWhiteSpace(currentfile)) + { + sfd.InitialDirectory = Path.GetDirectoryName(currentfile); + sfd.FileName = Path.GetFileName(currentfile); + } + else + { + sfd.InitialDirectory = PathManager.MakeAbsolutePath(Global.Config.PathGBPalettes, "GB"); + sfd.FileName = Global.Game.Name + ".pal"; + } sfd.Filter = "Gambatte Palettes (*.pal)|*.pal|All Files|*.*"; sfd.RestoreDirectory = true; - sfd.FileName = Path.GetFileName(currentfile); - var result = sfd.ShowDialog(this); if (result != System.Windows.Forms.DialogResult.OK) return;