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

Expose a nice wrapper for java.nio.file.Files.isX #354

Open
j-mie6 opened this issue Feb 8, 2025 · 1 comment
Open

Expose a nice wrapper for java.nio.file.Files.isX #354

j-mie6 opened this issue Feb 8, 2025 · 1 comment

Comments

@j-mie6
Copy link
Contributor

j-mie6 commented Feb 8, 2025

The Files.isReadable, Files.isWritable, Files.isExecutable, etc methods would be nice to have exposed in os-lib. Something like os.isReadable, or os.is.readable would be nice.

@j-mie6
Copy link
Contributor Author

j-mie6 commented Feb 8, 2025

That said, these methods don't work well if the file doesn't exist. One might assume that something like this would work more predictably:

def writable(path: os.Path): Boolean = path match {
    case parent / _ if !os.exists(path) => writable(parent)
    case path => os.exists(path) && java.nio.file.Files.isWritable(path.toNIO)
}

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