-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Copy file Attributes #2286
Copy file Attributes #2286
Conversation
Add Copy_Attributes flag
@@ -141,7 +142,8 @@ public static boolean copyFile(Path pathToSourceFile, Path pathToDestinationFile | |||
return false; | |||
} | |||
try { | |||
return Files.copy(pathToSourceFile, pathToDestinationFile, StandardCopyOption.REPLACE_EXISTING) != null; | |||
return Files.copy(pathToSourceFile, pathToDestinationFile, StandardCopyOption.REPLACE_EXISTING, | |||
StandardCopyOption.COPY_ATTRIBUTES) != null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code ensures that the file permission of the temporary file are kept in https://github.com/JabRef/jabref/pull/2286/files#diff-4925b1e29b2566af2796f9c99008b9ddR86, but as far as I can see there is no guarantee that the temporary file has the same permission attributes as the original file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tobiasdiez I am not sure either. However, the problem is that PosixPermission will fail on Windows with an exception
Okay, permissons are not copied. Maybe it is enough to check for Unix OS/POSIX support: |
Yes I think checking
should be enough. Do you want to add this, or should I? |
Please do add this. I am answering from phone 2016-11-18 23:51 GMT+01:00 Tobias Diez notifications@github.com:
|
Should fix #2285 and #2279 , too.
Edit// Needs Testing for #2285
Remove PosixFilePermission, as this will throw an Exception on Win
gradle localizationUpdate
?Add Copy_Attributes flag