mirror of
https://github.com/mitb-archive/filebot
synced 2025-03-09 05:51:31 -04:00
Correctly deal with broken symlinks when using --conflict override
https://www.filebot.net/forums/viewtopic.php?f=6&t=6174
This commit is contained in:
parent
06eb06830d
commit
360486848f
@ -600,7 +600,7 @@ public class CmdlineOperations implements CmdlineInterface {
|
|||||||
destination = resolve(source, destination);
|
destination = resolve(source, destination);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!destination.equals(source) && destination.exists()) {
|
if (!destination.equals(source) && existsNoFollowLinks(destination)) {
|
||||||
if (conflictAction == ConflictAction.FAIL) {
|
if (conflictAction == ConflictAction.FAIL) {
|
||||||
throw new CmdlineException(String.format("Failed to process [%s] because [%s] already exists", source, destination));
|
throw new CmdlineException(String.format("Failed to process [%s] because [%s] already exists", source, destination));
|
||||||
}
|
}
|
||||||
|
@ -159,6 +159,10 @@ public final class FileUtilities {
|
|||||||
return destination.toFile();
|
return destination.toFile();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static boolean existsNoFollowLinks(File file) {
|
||||||
|
return Files.exists(file.toPath(), LinkOption.NOFOLLOW_LINKS);
|
||||||
|
}
|
||||||
|
|
||||||
public static void delete(File file) throws IOException {
|
public static void delete(File file) throws IOException {
|
||||||
if (file.isDirectory()) {
|
if (file.isDirectory()) {
|
||||||
Files.walkFileTree(file.toPath(), new SimpleFileVisitor<Path>() {
|
Files.walkFileTree(file.toPath(), new SimpleFileVisitor<Path>() {
|
||||||
@ -620,8 +624,7 @@ public final class FileUtilities {
|
|||||||
/**
|
/**
|
||||||
* Strip file name of invalid characters
|
* Strip file name of invalid characters
|
||||||
*
|
*
|
||||||
* @param filename
|
* @param filename original filename
|
||||||
* original filename
|
|
||||||
* @return valid file name stripped of invalid characters
|
* @return valid file name stripped of invalid characters
|
||||||
*/
|
*/
|
||||||
public static String validateFileName(CharSequence filename) {
|
public static String validateFileName(CharSequence filename) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user