From 822cf2d38bcd86e7dc370ec748ea039505106996 Mon Sep 17 00:00:00 2001 From: David Korth Date: Sat, 15 Jan 2022 12:48:32 -0500 Subject: [PATCH] Split WUD handling: Use getAbsoluteFile() before getParentFile(). For some reason, on Linux, Java returns null for getParentFile() if we don't explicitly use getAbsoluteFile(). This also happens in a Windows 7 VM when using VirtualBox shared folders. Both setups used Java 8. --- .../java/de/mas/wiiu/jnus/implementations/wud/WUDImage.java | 2 +- .../jnus/implementations/wud/reader/WUDDiscReaderSplitted.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/mas/wiiu/jnus/implementations/wud/WUDImage.java b/src/main/java/de/mas/wiiu/jnus/implementations/wud/WUDImage.java index 093f157..ed75cab 100644 --- a/src/main/java/de/mas/wiiu/jnus/implementations/wud/WUDImage.java +++ b/src/main/java/de/mas/wiiu/jnus/implementations/wud/WUDImage.java @@ -132,7 +132,7 @@ public class WUDImage { private long calculateSplittedFileSize() { long result = 0; File filehandlePart1 = getFileHandle(); - String pathToFiles = filehandlePart1.getParentFile().getAbsolutePath(); + String pathToFiles = filehandlePart1.getAbsoluteFile().getParentFile().getAbsolutePath(); for (int i = 1; i <= WUDDiscReaderSplitted.NUMBER_OF_FILES; i++) { String filePartPath = pathToFiles + File.separator + String.format(WUDDiscReaderSplitted.WUD_SPLITTED_DEFAULT_FILEPATTERN, i); File part = new File(filePartPath); diff --git a/src/main/java/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReaderSplitted.java b/src/main/java/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReaderSplitted.java index 31bb5b6..2996105 100644 --- a/src/main/java/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReaderSplitted.java +++ b/src/main/java/de/mas/wiiu/jnus/implementations/wud/reader/WUDDiscReaderSplitted.java @@ -100,7 +100,7 @@ public class WUDDiscReaderSplitted extends WUDDiscReader { private RandomAccessFile getFileByOffset(long offset) throws IOException { File filehandlePart1 = getImage().getFileHandle(); - String pathToFiles = filehandlePart1.getParentFile().getAbsolutePath(); + String pathToFiles = filehandlePart1.getAbsoluteFile().getParentFile().getAbsolutePath(); int filePart = getFilePartByOffset(offset);