Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add function to see file-owner #97

Closed
emilaasa opened this issue May 24, 2023 · 0 comments
Closed

Add function to see file-owner #97

emilaasa opened this issue May 24, 2023 · 0 comments

Comments

@emilaasa
Copy link
Contributor

emilaasa commented May 24, 2023

Every now and then I run into the situation of figuring out the owner of a particular file or directory, and using java interop is a little bit clunky - my first naive implementation is something like this:

(Files/getOwner (Paths/get (java.net.URI. (str "file://" (.getCanonicalPath file))))
                (into-array LinkOption [LinkOption/NOFOLLOW_LINKS]))))

Since fs already has nice abstractions over LinkOption and Paths, it seems like a nice fit to add the higher level utilty of file-owner here as well, and end up with something like:

(fs/file-owner "/some/path/or/file")

I'm attaching a drafted PR that explains the intent: #98

emilaasa added a commit to emilaasa/fs that referenced this issue May 24, 2023
Add the ability to retrieve the owner of a file or directory via
Files/getOwner.
emilaasa added a commit to emilaasa/fs that referenced this issue May 24, 2023
Add the ability to retrieve the owner of a file or directory via
Files/getOwner.
@emilaasa emilaasa mentioned this issue May 24, 2023
2 tasks
emilaasa added a commit to emilaasa/fs that referenced this issue May 24, 2023
Use JVM system property user.name to figure out who the process owner
is, then compare that to both the owner of the home directory and a
temporary file created in process, which both should be the process
owner.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant