From 75970bee0474960337cd1e7f03f2d27eefe4a635 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Wed, 1 Oct 2008 04:10:39 +0000 Subject: [PATCH] use nsIDirectoryService to find the tmp directory --- content/io.js | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/content/io.js b/content/io.js index 0911aec8..799eb225 100644 --- a/content/io.js +++ b/content/io.js @@ -522,8 +522,6 @@ liberator.IO = function () //{{{ // FIXME: is there a reason the "TmpD" special directory isn't being used? -- djk createTempFile: function () { - let file = Components.classes["@mozilla.org/file/local;1"] - .createInstance(Components.interfaces.nsILocalFile); let tmpName = EXTENSION_NAME + ".tmp"; switch (EXTENSION_NAME) @@ -541,12 +539,10 @@ liberator.IO = function () //{{{ break; } - // TODO: Should we by trying /tmp first like Vim? - let dir = environmentService.get("TMPDIR") || environmentService.get("TMP") - || environmentService.get("TEMP") || (WINDOWS ? "C:\\" : "/tmp/"); - - file.initWithPath(dir); - file.appendRelativePath(tmpName); + let file = Components.classes["@mozilla.org/file/directory_service;1"] + .getService(Components.interfaces.nsIProperties) + .get("TmpD", Components.interfaces.nsIFile); + file.append(tmpName); file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0600); if (file.exists())