From 8c79dfb363f867bdeed93e9d292f9e588e627512 Mon Sep 17 00:00:00 2001 From: kappa1 Date: Thu, 7 Oct 2010 20:33:01 +0000 Subject: [PATCH] AppletLoader: move cache directory to a better location, as the current location is periodically purged on mac and linux. --- .../org/lwjgl/util/applet/AppletLoader.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/src/java/org/lwjgl/util/applet/AppletLoader.java b/src/java/org/lwjgl/util/applet/AppletLoader.java index ef68ba3b..c3d975f0 100644 --- a/src/java/org/lwjgl/util/applet/AppletLoader.java +++ b/src/java/org/lwjgl/util/applet/AppletLoader.java @@ -259,7 +259,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { */ public void init() { state = STATE_INIT; - + // sanity check String[] requiredArgs = {"al_main", "al_logo", "al_progressbar", "al_jars"}; for ( String requiredArg : requiredArgs ) { @@ -693,7 +693,7 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { } codebase += File.separator; } - return System.getProperty("java.io.tmpdir") + File.separator + codebase + getParameter("al_title") + File.separator; + return getCacheDir() + File.separator + codebase + getParameter("al_title") + File.separator; } }); @@ -775,6 +775,21 @@ public class AppletLoader extends Applet implements Runnable, AppletStub { loaderThread = null; } } + + /** + * get path to the lwjgl cache directory + * + * @return path to the lwjgl cache directory + */ + protected String getCacheDir() { + String cacheDir = System.getProperty("deployment.user.cachedir"); + + if (cacheDir == null) { + cacheDir = System.getProperty("java.io.tmpdir"); + } + + return cacheDir + File.separator + "lwjglcache"; + } /** * read the current version file