[FIX] Исправление ошибки при перезаписе файла

This commit is contained in:
Gravit 2019-05-21 03:49:08 +07:00
parent 227d0db778
commit 7f6a83fb66

View file

@ -13,6 +13,7 @@
import java.io.File; import java.io.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
import java.nio.file.Paths; import java.nio.file.Paths;
@ -82,6 +83,10 @@ public void postDiff(UpdateRequest request, UpdateRequestEvent e, HashedDir.Diff
LogHelper.debug("Copy file %s to %s", ret.toAbsolutePath().toString(), source.toAbsolutePath().toString()); LogHelper.debug("Copy file %s to %s", ret.toAbsolutePath().toString(), source.toAbsolutePath().toString());
//Let's go! //Let's go!
Files.copy(ret, source); Files.copy(ret, source);
try(InputStream input = IOHelper.newInput(ret))
{
IOHelper.transfer(input, source);
}
removed.add(path.replace('\\', '/')); removed.add(path.replace('\\', '/'));
} }
} }