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

Compliance with JSR-203 and JimFs #129

Open
ShaneDelmore opened this issue Mar 19, 2017 · 11 comments
Open

Compliance with JSR-203 and JimFs #129

ShaneDelmore opened this issue Mar 19, 2017 · 11 comments
Labels

Comments

@ShaneDelmore
Copy link
Contributor

Feature Suggestion:
It would be nice in tests to be able to use JimFs virtual file system (or any VFS really) instead of having to write to my actual file system and ensure resource cleanup after. I tested better-files with JimFs and overall it looks very compatible but calling Path.toFile is not supported.

http://docs.oracle.com/javase/8/docs/api/java/nio/file/Path.html#toFile--

https://github.com/google/jimfs/blob/3299e69f75cf524e6d101d88e8c202c1b24bf25a/jimfs/src/main/java/com/google/common/jimfs/JimfsPath.java#L409

@pathikrit
Copy link
Owner

Hmm, what am I supposed to do then here? I can get the URI from the path and create the file from the URI??

Or in general, should there be an implicit filesystem for the file class? I use that for any path <->file API??

@ShaneDelmore
Copy link
Contributor Author

@pathikrit
Copy link
Owner

Hi @ShaneDelmore - I have a PoC PR here: #130

Would this work??

@ShaneDelmore
Copy link
Contributor Author

Looks like a step in the right direction but it will still try to call Path.toFile won't it?

@pathikrit
Copy link
Owner

@ShaneDelmore : What should I do then?

@ShaneDelmore
Copy link
Contributor Author

I was hoping you would know of a workaround 😄
I'm out of town right now at NE Scala but I will see if I can figure out an alternative when I get back home in a few days.

@pathikrit
Copy link
Owner

Funnily I was in NEScala myself :) But, I am not sure what else is a good way to convert Path to a File!?

@ShaneDelmore
Copy link
Contributor Author

Do you need to convert a Path to a File at all? I think the NIO interface supports all of the usual operations on Paths through the Files class, as in Files.size(path) or Files.isDirectory(path).

@pathikrit
Copy link
Owner

Right but better-files does more than just that - for which I need a java.io.File

@ShaneDelmore
Copy link
Contributor Author

Any examples of a couple of things that definitely need java.io.File? Not sure I will be able to help come up with any solutions but it will give me something to attempt at least.

@som-snytt
Copy link

I have the same use case; for testing, a flakey FS simulates various unfriendly behaviors of a remote FS (that is also broken).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants