Skip to content

I expect copied files to have the same flags as the original file #5

@RutledgePaulV

Description

@RutledgePaulV

I've been copying some executable files and noticed the permission flags are getting dropped on a copy. It would be nice if the library defaulted to maintaining file flags.

My workaround:

(defn copy-permissions [from to]
  (when (fs/executable? from)
    (fs/chmod "+x" to))
  (when (fs/writeable? from)
    (fs/chmod "+w" to))
  (when (fs/readable? from)
    (fs/chmod "+r" to)))

(defonce _|HACK_TOWN
  (alter-var-root #'fs/copy
    (fn [old]
      (fn [from to]
        (old from to)
        (copy-permissions from to)))))

Happy to turn it into a PR if others are in agreement about the change in functionality.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions