summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/IOUtil.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-06-20 03:09:50 +0200
committerSven Gothel <[email protected]>2012-06-20 03:09:50 +0200
commitbf4d413ea185e857de534913c556f00435ba9f21 (patch)
tree3770b9b436d64c11ad4b77c80ca680204f98da26 /src/java/com/jogamp/common/util/IOUtil.java
parent05024570dbf5fce08fa8ff081cb696f0fc4b7f95 (diff)
Fix TempFileCache/LauncherTempFileCache (regression commit: 1468286bf569a493e4fdb887d5f3732f88c8cec3) 'update' scenario in same JVM instance.v2.0-rc9
TempFileCache/LauncherTempFileCache were using the system property 'jnlp.jogamp.tmp.cache.root', if set. However, in case one JVM launched an old GlueGen (Applet) and then launching a new GlueGen (Applet) w/ a new tmpDir location, the property is still set but the tmpRootDir location does not exist. This patch tolerates this situation and cont. setting a new tmpRootDir. Example: JVM1.GlueGen1 tmpDir: /tmp/, tmpRootDir: /tmp/jogamp.tmp.cache_000000/ JVM1.GlueGen2 tmpDir: /tmp/jogamp_0000/, tmpRootDir: /tmp/jogamp_0000/file_cache/ Misc: - IOUtil: Always use 'jogamp_xxxx' as the sys-temp subfolder for tmpDir - JNILibLoaderBase: Remove unised import - TempJarCache.validateCertificates(): Add OK DEBUG output.
Diffstat (limited to 'src/java/com/jogamp/common/util/IOUtil.java')
-rw-r--r--src/java/com/jogamp/common/util/IOUtil.java10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/java/com/jogamp/common/util/IOUtil.java b/src/java/com/jogamp/common/util/IOUtil.java
index 19ae683..09094bf 100644
--- a/src/java/com/jogamp/common/util/IOUtil.java
+++ b/src/java/com/jogamp/common/util/IOUtil.java
@@ -773,9 +773,8 @@ public class IOUtil {
/**
* This methods finds [and creates] an available temporary sub-directory:
* <pre>
- File tmpBaseDir;
+ File tmpBaseDir = null;
if(null != testDir(tmpRoot, true, executable)) { // check tmpRoot first
- tmpBaseDir = testDir(new File(tmpRoot, tmpSubDirPrefix), true, executable);
for(int i = 0; null == tmpBaseDir && i<=9999; i++) {
final String tmpDirSuffix = String.format("_%04d", i); // 4 digits for iteration
tmpBaseDir = testDir(new File(tmpRoot, tmpSubDirPrefix+tmpDirSuffix), true, executable);
@@ -797,9 +796,8 @@ public class IOUtil {
private static File getSubTempDir(File tmpRoot, String tmpSubDirPrefix, boolean executable)
throws SecurityException
{
- File tmpBaseDir;
+ File tmpBaseDir = null;
if(null != testDirImpl(tmpRoot, true /* create */, executable)) { // check tmpRoot first
- tmpBaseDir = testDirImpl(new File(tmpRoot, tmpSubDirPrefix), true /* create */, executable);
for(int i = 0; null == tmpBaseDir && i<=9999; i++) {
final String tmpDirSuffix = String.format("_%04d", i); // 4 digits for iteration
tmpBaseDir = testDirImpl(new File(tmpRoot, tmpSubDirPrefix+tmpDirSuffix), true /* create */, executable);
@@ -897,7 +895,7 @@ public class IOUtil {
/**
* Returns a platform independent writable directory for temporary files
* consisting of the platform's {@code temp-root} + {@link #tmpSubDir},
- * e.g. {@code /tmp/jogamp/}.
+ * e.g. {@code /tmp/jogamp_0000/}.
* <p>
* On standard Java the {@code temp-root} folder is specified by <code>java.io.tempdir</code>.
* </p>
@@ -911,7 +909,7 @@ public class IOUtil {
* </p>
* <p>
* In case {@code temp-root} is the users home folder,
- * a dot is being prepended to {@link #tmpSubDir}, i.e.: {@code /home/user/.jogamp/}.
+ * a dot is being prepended to {@link #tmpSubDir}, i.e.: {@code /home/user/.jogamp_0000/}.
* </p>
* @param executable true if the user intents to launch executables from the temporary directory, otherwise false.
* @param acc The security {@link AccessControlContext} to access properties, environment vars, create directories and test <i>executability</i>