mirror of https://github.com/quasar/Quasar.git
Merge pull request #515 from UbbeLoL/master
Add support for forward slashes in file manager
This commit is contained in:
commit
4f16f3898f
|
@ -35,9 +35,33 @@ public FrmFileManager(Client c)
|
|||
|
||||
private string GetAbsolutePath(string item)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(_currentDir) && _currentDir[0] == '/')
|
||||
if (_currentDir.Length == 1)
|
||||
return Path.Combine(_currentDir, item);
|
||||
else
|
||||
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.Remove(_currentDir.LastIndexOf('/') + 1);
|
||||
_currentDir = _currentDir.TrimEnd('/');
|
||||
}
|
||||
else
|
||||
_currentDir = "/";
|
||||
|
||||
SetCurrentDir(_currentDir);
|
||||
}
|
||||
else
|
||||
SetCurrentDir(GetAbsolutePath(@"..\"));
|
||||
}
|
||||
|
||||
private void FrmFileManager_Load(object sender, EventArgs e)
|
||||
{
|
||||
if (_connectClient != null)
|
||||
|
@ -71,7 +95,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:
|
||||
|
|
Loading…
Reference in New Issue