mirror of
https://github.com/GravitLauncher/Launcher
synced 2025-04-11 18:57:30 +03:00
[FIX] DirBridge.move
This commit is contained in:
parent
8d4473d5a3
commit
0871b11067
2 changed files with 5 additions and 4 deletions
|
@ -52,9 +52,10 @@ public static void move(Path newDir) throws IOException {
|
|||
LogHelper.dev(LogHelper.toString(new Throwable("Check stack of call DirBridge with null path...")));
|
||||
return;
|
||||
}
|
||||
Path oldUpdates = dirUpdates;
|
||||
dirUpdates = newDir;
|
||||
LogHelper.dev(newDir.toString());
|
||||
IOHelper.move(dirUpdates, newDir);
|
||||
IOHelper.move(oldUpdates, dirUpdates);
|
||||
}
|
||||
|
||||
public static Path getAppDataDir() throws IOException {
|
||||
|
|
|
@ -584,14 +584,13 @@ private MoveFileVisitor(Path from, Path to) {
|
|||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) throws IOException {
|
||||
public FileVisitResult preVisitDirectory(Path dir, BasicFileAttributes attrs) {
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
|
||||
IOHelper.copy(file, to.resolve(from.relativize(file)));
|
||||
Files.delete(file);
|
||||
Files.move(file, to.resolve(from.relativize(file)), COPY_OPTIONS);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
||||
|
@ -602,6 +601,7 @@ public FileVisitResult visitFileFailed(Path file, IOException exc) throws IOExce
|
|||
|
||||
@Override
|
||||
public FileVisitResult postVisitDirectory(Path dir, IOException exc) throws IOException {
|
||||
if (exc != null) throw exc;
|
||||
if (!this.from.equals(dir)) Files.delete(dir);
|
||||
return FileVisitResult.CONTINUE;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue