forked from mirrors/NBTExplorer
Hold down Ctrl to avoid using folder browse dlg
That dialog just plain sucks...you can't type in a path, for instance.
This commit is contained in:
parent
366ec3fe9e
commit
400eb1f80a
1 changed files with 24 additions and 7 deletions
|
@ -162,6 +162,8 @@ namespace NBTExplorer.Windows
|
|||
if (!ConfirmAction("Open new folder anyway?"))
|
||||
return;
|
||||
|
||||
if ((ModifierKeys & Keys.Control) == 0) {
|
||||
// if the user isn't holding Control, use the standard folder browser dialog
|
||||
using (FolderBrowserDialog ofd = new FolderBrowserDialog()) {
|
||||
if (_openFolderPath != null)
|
||||
ofd.SelectedPath = _openFolderPath;
|
||||
|
@ -171,6 +173,21 @@ namespace NBTExplorer.Windows
|
|||
OpenPaths(new string[] { ofd.SelectedPath });
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// otherwise, use a file open dialog and open whichever directory has the selected file
|
||||
using (OpenFileDialog ofd = new OpenFileDialog()) {
|
||||
ofd.Title = "Select any file in the directory to open";
|
||||
ofd.Filter = "All files (*.*)|*.*";
|
||||
|
||||
if (_openFolderPath != null)
|
||||
ofd.InitialDirectory = _openFolderPath;
|
||||
|
||||
if (ofd.ShowDialog() == DialogResult.OK) {
|
||||
_openFolderPath = Path.GetDirectoryName(ofd.FileName);
|
||||
OpenPaths(new string[] { _openFolderPath });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
UpdateUI();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue