mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-15 16:20:03 +00:00
Fix bug when trying to determine file size for files (instead of directories)
This commit is contained in:
@@ -104,8 +104,19 @@ public class GameMapper {
|
||||
|
||||
stopWatch.start();
|
||||
|
||||
// Some benchmarks I did have shown that trying to parallelize this process makes it slower instead of faster
|
||||
long fileSize = FileUtils.sizeOfDirectory(path.toFile());
|
||||
long fileSize;
|
||||
|
||||
if(Files.isDirectory(path)) {
|
||||
// Some benchmarks I did have shown that trying to parallelize this process makes it slower instead of faster
|
||||
fileSize = FileUtils.sizeOfDirectory(path.toFile());
|
||||
} else {
|
||||
try{
|
||||
fileSize = Files.size(path);
|
||||
} catch (IOException e) {
|
||||
log.error("Error while calculating size of file '{}'.", path);
|
||||
fileSize = -1L;
|
||||
}
|
||||
}
|
||||
|
||||
stopWatch.stop();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user