diff --git a/DearFTP/Connection/Commands/MakeDirectoryCommand.cs b/DearFTP/Connection/Commands/MakeDirectoryCommand.cs index 59877a4..257d53a 100644 --- a/DearFTP/Connection/Commands/MakeDirectoryCommand.cs +++ b/DearFTP/Connection/Commands/MakeDirectoryCommand.cs @@ -22,33 +22,33 @@ namespace DearFTP.Connection.Commands return; } - var newDirectory = session.NavigablePath.GetNewSystemFilePath(argument); + var (navigablePath, realPath) = session.NavigablePath.GetNewSystemFilePath(argument); - if (newDirectory.navigablePath.CurrentDirectory == "/") + if (navigablePath.CurrentDirectory == "/") { stream.Send(ResponseCode.FileUnavailable, "Can't modify the root."); return; } - if (newDirectory.realPath == null) + if (realPath == null) { stream.Send(ResponseCode.FileUnavailable, "Invalid destination path."); return; } - if (File.Exists(newDirectory.realPath) || Directory.Exists(newDirectory.realPath)) + if (File.Exists(realPath) || Directory.Exists(realPath)) { stream.Send(ResponseCode.FileUnavailable, "Destination path already exists."); return; } - if (!session.WritablesShares.Contains(newDirectory.navigablePath.CurrentShare)) + if (!session.WritablesShares.Contains(navigablePath.CurrentShare)) { stream.Send(ResponseCode.FileUnavailable, "You don't have write access to this file."); return; } - Directory.CreateDirectory(newDirectory.realPath); + Directory.CreateDirectory(realPath); stream.Send(ResponseCode.FileActionOK, "Directory successfully created."); }