fix trailing forward-slash

This commit is contained in:
ubbelol 2016-08-25 18:03:49 +02:00
parent 81f45fdf8a
commit 93b87a7f62
1 changed files with 9 additions and 2 deletions

View File

@ -36,7 +36,10 @@ public FrmFileManager(Client c)
private string GetAbsolutePath(string item)
{
if (!string.IsNullOrEmpty(_currentDir) && _currentDir[0] == '/')
return Path.Combine(_currentDir, item + '/');
if (_currentDir.Length == 1)
return Path.Combine(_currentDir, item);
else
return Path.Combine(_currentDir + '/', item);
return Path.GetFullPath(Path.Combine(_currentDir, item));
}
@ -47,9 +50,13 @@ private void NavigateUp()
{
if (_currentDir.LastIndexOf('/') > 0)
{
_currentDir = _currentDir.Remove(_currentDir.LastIndexOf('/') + 1);
_currentDir = _currentDir.TrimEnd('/');
SetCurrentDir(_currentDir.Remove(_currentDir.LastIndexOf('/') + 1));
}
else
_currentDir = "/";
SetCurrentDir(_currentDir);
}
else
SetCurrentDir(GetAbsolutePath(@"..\"));