Fix NavigablePath
Copy was in reverse order
This commit is contained in:
@@ -28,7 +28,7 @@ namespace DearFTP.Utils
|
|||||||
CurrentShare = navigablePath.CurrentShare;
|
CurrentShare = navigablePath.CurrentShare;
|
||||||
CurrentDirectory = navigablePath.CurrentDirectory;
|
CurrentDirectory = navigablePath.CurrentDirectory;
|
||||||
|
|
||||||
_path = new Stack<string>(navigablePath._path);
|
_path = new Stack<string>(navigablePath._path.Reverse());
|
||||||
}
|
}
|
||||||
|
|
||||||
public string GetFilePath(string fileName)
|
public string GetFilePath(string fileName)
|
||||||
@@ -193,7 +193,7 @@ namespace DearFTP.Utils
|
|||||||
|
|
||||||
public bool NavigateTo(string path)
|
public bool NavigateTo(string path)
|
||||||
{
|
{
|
||||||
var oldPath = new Stack<string>(_path);
|
var oldPath = new Stack<string>(_path.Reverse());
|
||||||
var queue = new Queue<string>(path.Split('/'));
|
var queue = new Queue<string>(path.Split('/'));
|
||||||
|
|
||||||
// If absolute path
|
// If absolute path
|
||||||
@@ -205,7 +205,7 @@ namespace DearFTP.Utils
|
|||||||
|
|
||||||
if (NavigateTo(queue))
|
if (NavigateTo(queue))
|
||||||
{
|
{
|
||||||
CurrentDirectory = $"/{string.Join('/', _path)}";
|
CurrentDirectory = $"/{string.Join('/', _path.Reverse())}";
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -269,7 +269,7 @@ namespace DearFTP.Utils
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return Path.Combine(_path.Skip(1).Prepend(CurrentShare.Path).ToArray());
|
return Path.Combine(_path.Reverse().Skip(1).Prepend(CurrentShare.Path).ToArray());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user