Skip to content

Commit

Permalink
Merge pull request quasar#515 from UbbeLoL/master
Browse files Browse the repository at this point in the history
Add support for forward slashes in file manager
  • Loading branch information
MaxXor authored Aug 29, 2016
2 parents 0af92c6 + 93b87a7 commit 4f16f38
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion Server/Forms/FrmFileManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 4f16f38

Please sign in to comment.