Merge branch 'master' of github.com:Araq/Nimrod
This commit is contained in:
commit
9e5aee62a4
1 changed files with 22 additions and 1 deletions
|
|
@ -230,6 +230,27 @@ proc createDir*(ftp: var TFTPClient, dir: string, recursive: bool = false) =
|
|||
previousDirs.add('/')
|
||||
assertReply reply, "257"
|
||||
|
||||
proc chmod*(ftp: var TFTPClient, path: string,
|
||||
permissions: set[TFilePermission]) =
|
||||
## Changes permission of ``path`` to ``permissions``.
|
||||
var userOctal = 0
|
||||
var groupOctal = 0
|
||||
var otherOctal = 0
|
||||
for i in items(permissions):
|
||||
case i
|
||||
of fpUserExec: userOctal.inc(1)
|
||||
of fpUserWrite: userOctal.inc(2)
|
||||
of fpUserRead: userOctal.inc(4)
|
||||
of fpGroupExec: groupOctal.inc(1)
|
||||
of fpGroupWrite: groupOctal.inc(2)
|
||||
of fpGroupRead: groupOctal.inc(4)
|
||||
of fpOthersExec: otherOctal.inc(1)
|
||||
of fpOthersWrite: otherOctal.inc(2)
|
||||
of fpOthersRead: otherOctal.inc(4)
|
||||
|
||||
var perm = $userOctal & $groupOctal & $otherOctal
|
||||
assertReply ftp.send("SITE CHMOD " & perm & " " & path), "200"
|
||||
|
||||
proc list*(ftp: var TFTPClient, dir: string = "", async = false): string =
|
||||
## Lists all files in ``dir``. If ``dir`` is ``""``, uses the current
|
||||
## working directory. If ``async`` is true, this function will return
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue