Raynes / fs

File system utilities for Clojure.
453 stars 119 forks source link

Tests don't run cleanly on Windows #93

Closed jokimaki closed 8 years ago

jokimaki commented 9 years ago

There are a couple of issues when running tests on Windows 7.

As Windows doesn't support symlinks, an exception is thrown:

Exception in thread "main" java.nio.file.FileSystemException: C:\work\fs\test\me\raynes\testfiles\soft.link: A required privilege is not held by the client.

    at sun.nio.fs.WindowsException.translateToIOException(Unknown Source)
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at sun.nio.fs.WindowsException.rethrowAsIOException(Unknown Source)
    at sun.nio.fs.WindowsFileSystemProvider.createSymbolicLink(Unknown Source)
    at java.nio.file.Files.createSymbolicLink(Unknown Source)
    at me.raynes.fs$sym_link.invoke(fs.clj:192)
    at me.raynes.core_test$eval8342$fn__8343$fn__8344.invoke(core_test.clj:357)
    (...)

Two files are left behind by tests:

What do you think would be the best approach to fix incompatibilities with Windows? Do you know of any way to check if the OS supports symlinks, or should we just check os.name property?

Raynes commented 9 years ago

I don't really try to support Windows very hard. Kinda hoped someone who actually used windows would come along and spruce things up in that area.

jokimaki commented 9 years ago

Well I'll be glad to help at least this bit :)

http://stackoverflow.com/questions/19964600/how-to-check-if-filesystem-supports-links-and-symlinks-in-java suggests that the only way to check the symlink support would be to try and handle exceptions. So perhaps I'll create a PR with os.name based conditional tests.

dhakehurst commented 6 years ago

Windows does support symlinks (now).

https://ss64.com/nt/mklink.html