Fix style issue
Now use deconstructor
This commit is contained in:
@@ -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.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user