From: <ma...@us...> - 2008-04-10 21:02:32
|
Revision: 3004 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3004&view=rev Author: matzon Date: 2008-04-10 14:02:04 -0700 (Thu, 10 Apr 2008) Log Message: ----------- support for prepending host to cache path (defaults to true) Modified Paths: -------------- trunk/LWJGL/applet/appletloader.html trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java Modified: trunk/LWJGL/applet/appletloader.html =================================================================== --- trunk/LWJGL/applet/appletloader.html 2008-04-10 20:47:29 UTC (rev 3003) +++ trunk/LWJGL/applet/appletloader.html 2008-04-10 21:02:04 UTC (rev 3004) @@ -50,6 +50,9 @@ <!-- whether to run in debug mode --> <!-- <param name="al_debug" value="false"> --> + <!-- whether to prepend host to cache path - defaults to true --> + <param name="al_prepend_host" value="false"> + <!-- main applet specific params --> <param name="test" value="org.lwjgl.test.opengl.awt.AWTGearsCanvas"> Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2008-04-10 20:47:29 UTC (rev 3003) +++ trunk/LWJGL/src/java/org/lwjgl/util/applet/AppletLoader.java 2008-04-10 21:02:04 UTC (rev 3004) @@ -183,6 +183,9 @@ /** whether we're running in debug mode */ protected boolean debugMode; + /** whether to prepend host to cache path */ + protected boolean prependHost; + /** String to display as a subtask */ protected String subtaskMessage = ""; @@ -221,6 +224,9 @@ // whether to run in debug mode debugMode = getBooleanParameter("al_debug", false); + // whether to prepend host to cache path + prependHost = getBooleanParameter("al_prepend_host", true); + // get colors of applet bgColor = getColor("al_bgcolor", Color.white); setBackground(bgColor); @@ -486,7 +492,17 @@ // get path where applet will be stored String path = (String) AccessController.doPrivileged(new PrivilegedExceptionAction() { public Object run() throws Exception { - return System.getProperty("java.io.tmpdir") + File.separator + getParameter("al_title") + File.separator; + + // we append the code base to avoid naming collisions with al_title + String codebase = ""; + if(prependHost) { + codebase = getCodeBase().getHost(); + if(codebase == null || codebase.length() == 0) { + codebase = "localhost"; + } + codebase += File.separator; + } + return System.getProperty("java.io.tmpdir") + File.separator + codebase + getParameter("al_title") + File.separator; } }); @@ -494,7 +510,7 @@ // create directory if (!dir.exists()) { - dir.mkdir(); + dir.mkdirs(); } dir = new File(dir, "version"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |