Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
8280369: native library cache should be platform/arch specific
Reviewed-by: jvos
  • Loading branch information
Glavo authored and Johan Vos committed Mar 29, 2022
1 parent d1fb3d3 commit a0db473
Showing 1 changed file with 5 additions and 3 deletions.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2010, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2010, 2022, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
Expand Down Expand Up @@ -235,8 +235,9 @@ private static boolean installLibraryFromResource(String libraryName, List<Strin
private static String cacheLibrary(InputStream is, String name, Class caller) throws IOException {
String jfxVersion = System.getProperty("javafx.runtime.version", "versionless");
String userCache = System.getProperty("javafx.cachedir", "");
String arch = System.getProperty("os.arch");
if (userCache.isEmpty()) {
userCache = System.getProperty("user.home") + "/.openjfx/cache/" + jfxVersion;
userCache = System.getProperty("user.home") + "/.openjfx/cache/" + jfxVersion + "/" + arch;
}
File cacheDir = new File(userCache);
boolean cacheDirOk = true;
Expand All @@ -257,7 +258,8 @@ private static String cacheLibrary(InputStream is, String name, Class caller) th
}
if (!cacheDirOk) {
String username = System.getProperty("user.name", "anonymous");
String tmpCache = System.getProperty("java.io.tmpdir") + "/.openjfx_" + username + "/cache/" + jfxVersion;
String tmpCache = System.getProperty("java.io.tmpdir") + "/.openjfx_" + username
+ "/cache/" + jfxVersion + "/" + arch;
cacheDir = new File(tmpCache);
if (cacheDir.exists()) {
if (!cacheDir.isDirectory()) {
Expand Down

1 comment on commit a0db473

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.