nim-lang / fusion

Fusion is for now an idea about how to grow Nim's ecosystem without the pain points of more traditional approaches.
MIT License
128 stars 16 forks source link

Improve filepermissions #50

Closed juancarlospaco closed 3 years ago

juancarlospaco commented 3 years ago
chmod("example.txt", "rw-r--r--")
chmod("example.txt", "rwxrwxrwx")

(I tried to use a for loop and gives same metrics as the if's so I went with the simpler code)

carpincho-capybara commented 3 years ago

Me agrada tu idea. :+1:

juancarlospaco commented 3 years ago

What do you think about this @timotheecour ?, should it use array[9, char] instead ?, something else?.

timotheecour commented 3 years ago

/cc @xflywind @juancarlospaco let's discuss alternatives see https://github.com/nim-lang/fusion/pull/50#discussion_r550382167

I think

proc chmod*(path: string; update: string) {.inline.} =
  let old = getFilePermissions(path)
  let perm = updateFilePermissions(old, update)
  setFilePermissions(path, perm)

is good but I'm not sure about the right format to use for update: