mirror of
https://github.com/Suiranoil/SkinRestorer.git
synced 2026-01-16 04:42:12 +00:00
do not replace an already existing skin file when migrating
This commit is contained in:
@@ -33,8 +33,13 @@ public final class FileUtils {
|
||||
if (!files.isEmpty() && !Files.exists(newDirectory))
|
||||
Files.createDirectories(newDirectory);
|
||||
|
||||
for (var file : files)
|
||||
Files.move(file, newDirectory.resolve(file.getFileName()), StandardCopyOption.REPLACE_EXISTING);
|
||||
for (var file : files) {
|
||||
var newFile = newDirectory.resolve(file.getFileName());
|
||||
if (!Files.exists(newFile))
|
||||
Files.move(file, newFile, StandardCopyOption.ATOMIC_MOVE);
|
||||
else
|
||||
Files.delete(file);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
SkinRestorer.LOGGER.error("could not migrate skin directory", e);
|
||||
|
||||
Reference in New Issue
Block a user