Add support for forward slashes in file manager

This commit is contained in:
ubbelol 2016-08-24 15:48:13 +02:00
parent a8bc36cfba
commit 8f488a68ad
1 changed files with 18 additions and 1 deletions

View File

@ -35,8 +35,25 @@ public FrmFileManager(Client c)
private string GetAbsolutePath(string item)
{
if (!string.IsNullOrEmpty(_currentDir) && _currentDir[0] == '/')
return Path.Combine(_currentDir, item + '/');
return Path.GetFullPath(Path.Combine(_currentDir, item));
}
private void NavigateUp()
{
if (!string.IsNullOrEmpty(_currentDir) && _currentDir[0] == '/')
{
if (_currentDir.LastIndexOf('/') > 0)
{
_currentDir = _currentDir.TrimEnd('/');
SetCurrentDir(_currentDir.Remove(_currentDir.LastIndexOf('/') + 1));
}
}
else
SetCurrentDir(GetAbsolutePath(@"..\"));
}
private void FrmFileManager_Load(object sender, EventArgs e)
{
@ -71,7 +88,7 @@ private void lstDirectory_DoubleClick(object sender, EventArgs e)
switch (type)
{
case PathType.Back:
SetCurrentDir(Path.GetFullPath(Path.Combine(_currentDir, @"..\")));
NavigateUp();
RefreshDirectory();
break;
case PathType.Directory: