Ref: simplify getInstance, do not put context on a singleton

This commit is contained in:
Sheepit Renderfarm
2024-11-20 23:13:00 +00:00
parent ac7572d0b0
commit 844d8b7f99
10 changed files with 32 additions and 33 deletions

View File

@@ -72,19 +72,19 @@ public class DirectoryManager {
Files.deleteIfExists(targetArchivePath); // createLink only works if the target does not exist
try {
Files.createLink(targetArchivePath, existingArchivePath);
Log.getInstance(configuration).debug("Created hardlink from " + targetArchivePath + " to " + existingArchivePath);
Log.getInstance().debug("Created hardlink from " + targetArchivePath + " to " + existingArchivePath);
}
catch (UnsupportedOperationException // underlying file system does not support hard-linking
| FileSystemException // cache-dir and shared-zip are on separate file systems, even though hard-linking is supported
| SecurityException // user is not allowed to create hard-links
ignore) {
// Creating hardlinks might not be supported on some filesystems
Log.getInstance(configuration).debug("Failed to create hardlink, falling back to copying file to " + targetArchivePath);
Log.getInstance().debug("Failed to create hardlink, falling back to copying file to " + targetArchivePath);
Files.copy(existingArchivePath, targetArchivePath, StandardCopyOption.REPLACE_EXISTING);
}
}
catch (IOException e) {
Log.getInstance(configuration).error("Error while copying " + source + " from shared downloads directory to working dir");
Log.getInstance().error("Error while copying " + source + " from shared downloads directory to working dir");
return false;
}