From f43c9208f34c06434514af100b1786e94a2ec3e2 Mon Sep 17 00:00:00 2001 From: Michael Bayne Date: Thu, 1 Feb 2007 04:00:44 +0000 Subject: [PATCH] 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 --- .../com/threerings/resource/ResourceBundle.java | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/java/com/threerings/resource/ResourceBundle.java b/src/java/com/threerings/resource/ResourceBundle.java index a3f41803..62da0fc0 100644 --- a/src/java/com/threerings/resource/ResourceBundle.java +++ b/src/java/com/threerings/resource/ResourceBundle.java @@ -359,22 +359,24 @@ public class ResourceBundle Log.info("No system defined temp directory. Faking it."); tmpdir = System.getProperty("user.home"); } - setCacheDir(new File(tmpdir, ".narcache")); + setCacheDir(new File(tmpdir)); } return _tmpdir; } /** - * Specifies the directory in which our temporary resource files - * should be stored. + * Specifies the directory in which our temporary resource files should be stored. */ public static void setCacheDir (File tmpdir) { String rando = Long.toHexString((long)(Math.random() * Long.MAX_VALUE)); - _tmpdir = new File(tmpdir, rando); + _tmpdir = new File(tmpdir, "narcache_" + rando); if (!_tmpdir.exists()) { - Log.info("Creating narya temp cache directory '" + _tmpdir + "'."); - _tmpdir.mkdirs(); + if (_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