From f6c593ac7da374c21d43df0f4b657565dcbb9903 Mon Sep 17 00:00:00 2001 From: chenzw95 Date: Thu, 31 Mar 2016 00:20:17 +0800 Subject: [PATCH 1/2] Explicitly set InitialDirectory when creating new OpenFileDialog Probably fixes most "no disk in drive" issues. --- PKX/f1-Main.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index a456f6cb8..e2583506c 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -193,6 +193,7 @@ private void mainMenuOpen(object sender, EventArgs e) "|EKX File|*.ek6;*.ekx" + "|BIN File|*.bin" + "|All Files|*.*", + InitialDirectory = Environment.CurrentDirectory, RestoreDirectory = true, FilterIndex = 4, FileName = "main", From 2ac37336ddf5390911a3392f986f13a7b0e3f25e Mon Sep 17 00:00:00 2001 From: chenzw95 Date: Thu, 31 Mar 2016 01:14:32 +0800 Subject: [PATCH 2/2] Reset OpenFileDialog path only if it does not exist --- PKX/f1-Main.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/PKX/f1-Main.cs b/PKX/f1-Main.cs index e2583506c..113ef8871 100644 --- a/PKX/f1-Main.cs +++ b/PKX/f1-Main.cs @@ -193,12 +193,15 @@ private void mainMenuOpen(object sender, EventArgs e) "|EKX File|*.ek6;*.ekx" + "|BIN File|*.bin" + "|All Files|*.*", - InitialDirectory = Environment.CurrentDirectory, RestoreDirectory = true, FilterIndex = 4, FileName = "main", }; + // Reset file dialog path if it no longer exists + if (!Directory.Exists(ofd.InitialDirectory)) + ofd.InitialDirectory = Environment.CurrentDirectory; + // Detect main string cyberpath = Util.GetTempFolder(); pathSDF = Util.GetSDFLocation();