-
Notifications
You must be signed in to change notification settings - Fork 145
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
linkTo seams to be broken #221
Comments
Isn't this obvious from the types? The return types of both method return the |
No... I was not precise enough... sorry. Problem is when java API is called. it means destination is different in both and it'll satisfy compiler contract in both cases. link.symbolicLinkTo(f)
// will call Files.createSymbolicLink(link, f)
// and return f
link.linkTo(f) //expected same api like in symbolicLinkTo
/**
will call Files.createLink(f, link)... ops
and throw Error
java.nio.file.NoSuchFileException: /tmp/491470459606103590ar-152-Swieta_Bozonarodzeniowe.ppt ->
/tmp/1058432223189661722
sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
sun.nio.fs.UnixFileSystemProvider.createLink(UnixFileSystemProvider.java:476)
java.nio.file.Files.createLink(Files.java:1086)
better.files.File.linkTo(File.scala:674
*/
f.linkTo(link)
// will call Files.createLink(link, f)
//and return link
f.symbolicLinkTo(link)
/**
java.nio.file.FileAlreadyExistsException: /tmp/491470459606103590ar-152-Swieta_Bozonarodzeniowe.ppt
sun.nio.fs.UnixException.translateToIOException(UnixException.java:88)
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)
sun.nio.fs.UnixFileSystemProvider.createSymbolicLink(UnixFileSystemProvider.java:457)
java.nio.file.Files.createSymbolicLink(Files.java:1043)
better.files.File.symbolicLinkTo(File.scala:668)
*/ To be honest it seams to be messed! |
I intentionally named these methods with |
java api is consistent here:
|
I still don't understand - can you send a quick PR of what you want? |
I got hit by this too. It seems like the intended behavior is to have File(newLinkPath).linkTo(existingFile) in both cases, but its actually swapped depending on the symbolic link flag. Right now its this: File(existingFilePath).linkTo(newLinkFile, false) It looks like an unintended argument swap on the Java method call more than anything, as it does seem pretty unexpected to have the source/dest change based on an optional flag. If you agree, let me know the intended order and I'll create a PR to fix it. If this is the intended behavior, I can add something to your docs or wiki that explains the working of the feature. |
@gblahaerath : Yes intention is to have consistent |
Current implementation of
symbolicLinkTo
andlinkTo
seams to be incorect.Current code:
Java API looks like this.
In java path link is always first argument!, and in current implementation it is inconsistant.
The text was updated successfully, but these errors were encountered: