Fixed ftpclient.createDir.

This commit is contained in:
dom96 2011-11-29 18:54:24 +00:00
commit 710ee8c67d

View file

@ -222,9 +222,12 @@ proc createDir*(ftp: var TFTPClient, dir: string, recursive: bool = false) =
assertReply ftp.send("MKD " & dir), "257" assertReply ftp.send("MKD " & dir), "257"
else: else:
var reply = TaintedString"" var reply = TaintedString""
var previousDirs = ""
for p in split(dir, {os.dirSep, os.altSep}): for p in split(dir, {os.dirSep, os.altSep}):
if p != "": if p != "":
reply = ftp.send("MKD " & p) previousDirs.add(p)
reply = ftp.send("MKD " & previousDirs)
previousDirs.add('/')
assertReply reply, "257" assertReply reply, "257"
proc list*(ftp: var TFTPClient, dir: string = "", async = false): string = proc list*(ftp: var TFTPClient, dir: string = "", async = false): string =