mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2025-08-16 13:47:28 +02:00
Update app/common/src/main/java/stirling/software/common/util/GeneralUtils.java
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
31d1ecae7d
commit
fef607ec4a
@ -538,7 +538,12 @@ public class GeneralUtils {
|
||||
Path tmp = Files.createTempFile(dir, target.getFileName().toString(), ".tmp");
|
||||
try (InputStream in = resource.getInputStream()) {
|
||||
Files.copy(in, tmp, StandardCopyOption.REPLACE_EXISTING);
|
||||
Files.move(tmp, target, StandardCopyOption.ATOMIC_MOVE);
|
||||
try {
|
||||
Files.move(tmp, target, StandardCopyOption.ATOMIC_MOVE);
|
||||
} catch (AtomicMoveNotSupportedException e) {
|
||||
log.warn("Atomic move not supported, falling back to non-atomic move for {}", target, e);
|
||||
Files.move(tmp, target, StandardCopyOption.REPLACE_EXISTING);
|
||||
}
|
||||
} catch (FileAlreadyExistsException e) {
|
||||
log.debug("File already exists at {}", target);
|
||||
try {
|
||||
|
Loading…
Reference in New Issue
Block a user