fixed file system navigation.

This commit is contained in:
morkt 2015-12-01 11:23:47 +04:00
parent 8bdde818c9
commit 95e861c5b1
2 changed files with 17 additions and 3 deletions

View File

@ -595,7 +595,10 @@ namespace GameRes
m_vfs.Pop();
while (Count < desired_vfs_count)
{
m_vfs.ChDir (m_vfs.Top.FindFile (desired[Count-1]));
var entry = m_vfs.Top.FindFile (desired[Count-1]);
if (entry is SubDirEntry)
throw new FileNotFoundException();
m_vfs.ChDir (entry);
}
m_vfs.Top.CurrentDirectory = desired.Last();
}

View File

@ -105,7 +105,8 @@ namespace GARbro.GUI
}
ViewModel = vm;
lv_SelectItem (0);
SetStatusText (guiStrings.MsgReady);
if (!vm.IsArchive)
SetStatusText (guiStrings.MsgReady);
}
void WindowKeyDown (object sender, KeyEventArgs e)
@ -640,6 +641,8 @@ namespace GARbro.GUI
m_current_input.Mismatch = true;
}
static readonly Regex FullpathRe = new Regex (@"^(?:[a-z]:|[\\/])", RegexOptions.IgnoreCase);
private void acb_OnKeyDown (object sender, KeyEventArgs e)
{
if (e.Key != Key.Return)
@ -647,6 +650,11 @@ namespace GARbro.GUI
string path = (sender as AutoCompleteBox).Text;
if (string.IsNullOrEmpty (path))
return;
if (FullpathRe.IsMatch (path))
{
OpenFile (path);
return;
}
try
{
PushViewModel (GetNewViewModel (path));
@ -750,7 +758,10 @@ namespace GARbro.GUI
return;
try
{
VFS.FullPath = new string[] { filename, "" };
if (File.Exists (filename))
VFS.FullPath = new string[] { filename, "" };
else
VFS.FullPath = new string[] { filename };
var vm = new DirectoryViewModel (VFS.FullPath, VFS.GetFiles(), VFS.IsVirtual);
PushViewModel (vm);
if (null != VFS.CurrentArchive)