Ref: simplify getInstance, do not put context on a singleton
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user