Skip to content

Commit 3770905

Browse files
committed
U fixes the path to the JRE on MacOS if release file not found
1 parent f15d3f5 commit 3770905

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

src/main/java/io/github/fvarrui/javapackager/utils/FileUtils.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,9 @@ public static void downloadFromUrl(URL url, File file) throws IOException {
211211
public static boolean exists(File file) {
212212
return file != null && file.exists();
213213
}
214+
215+
public static boolean folderContainsFile(File folder, String filename) {
216+
return new File(folder, filename).exists();
217+
}
214218

215219
}

src/main/java/io/github/fvarrui/javapackager/utils/JDKUtils.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
public class JDKUtils {
1414

1515
/**
16-
* Converts "release" file from specified JDK to map
16+
* Converts "release" file from specified JDK or JRE to map
1717
* @param jdkPath JDK directory path
1818
* @return Map with all properties
1919
* @throws FileNotFoundException release file not found
@@ -31,6 +31,14 @@ private static Map<String, String> getRelease(File jdkPath) throws FileNotFoundE
3131
return propertiesMap;
3232
}
3333

34+
/**
35+
* Checks if the platform specified in the "release" file matches the required platform
36+
* @param platform
37+
* @param jdkPath
38+
* @return
39+
* @throws FileNotFoundException
40+
* @throws IOException
41+
*/
3442
private static boolean checkPlatform(Platform platform, File jdkPath) throws FileNotFoundException, IOException {
3543
Map<String, String> releaseMap = getRelease(jdkPath);
3644
String osName = releaseMap.get("OS_NAME");

0 commit comments

Comments
 (0)