Let's not create a globally shared temp directory to avoid freakout if multiple
servers are running on the same host as different users. git-svn-id: svn+ssh://src.earth.threerings.net/nenya/trunk@133 ed5b42cb-e716-0410-a449-f6a68f950b19
This commit is contained in:
@@ -359,22 +359,24 @@ public class ResourceBundle
|
|||||||
Log.info("No system defined temp directory. Faking it.");
|
Log.info("No system defined temp directory. Faking it.");
|
||||||
tmpdir = System.getProperty("user.home");
|
tmpdir = System.getProperty("user.home");
|
||||||
}
|
}
|
||||||
setCacheDir(new File(tmpdir, ".narcache"));
|
setCacheDir(new File(tmpdir));
|
||||||
}
|
}
|
||||||
return _tmpdir;
|
return _tmpdir;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specifies the directory in which our temporary resource files
|
* Specifies the directory in which our temporary resource files should be stored.
|
||||||
* should be stored.
|
|
||||||
*/
|
*/
|
||||||
public static void setCacheDir (File tmpdir)
|
public static void setCacheDir (File tmpdir)
|
||||||
{
|
{
|
||||||
String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE));
|
String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE));
|
||||||
_tmpdir = new File(tmpdir, rando);
|
_tmpdir = new File(tmpdir, "narcache_" + rando);
|
||||||
if (!_tmpdir.exists()) {
|
if (!_tmpdir.exists()) {
|
||||||
Log.info("Creating narya temp cache directory '" + _tmpdir + "'.");
|
if (_tmpdir.mkdirs()) {
|
||||||
_tmpdir.mkdirs();
|
Log.info("Created narya temp cache directory '" + _tmpdir + "'.");
|
||||||
|
} else {
|
||||||
|
Log.warning("Failed to create temp cache directory '" + _tmpdir + "'.");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add a hook to blow away the temp directory when we exit
|
// add a hook to blow away the temp directory when we exit
|
||||||
|
|||||||
Reference in New Issue
Block a user