Bug 1114593 - Replace defaultDownloadsDirectory calls in DirectoryProvider.js. r=mfinkle

--HG--
extra : rebase_source : 8e6574838cafecc5c26ed68a1d1a4b3cb6a6a617
This commit is contained in:
Margaret Leibovic 2014-12-22 14:59:03 -05:00
parent 67e8743218
commit 4a92ddb2cb

View File

@ -25,7 +25,7 @@ const XRE_APP_DISTRIBUTION_DIR = "XREAppDist";
const XRE_UPDATE_ROOT_DIR = "UpdRootD"; const XRE_UPDATE_ROOT_DIR = "UpdRootD";
const ENVVAR_UPDATE_DIR = "UPDATES_DIRECTORY"; const ENVVAR_UPDATE_DIR = "UPDATES_DIRECTORY";
const WEBAPPS_DIR = "webappsDir"; const WEBAPPS_DIR = "webappsDir";
const DOWNLOAD_DIR = "DfltDwnld" const DOWNLOAD_DIR = "DfltDwnld";
const SYSTEM_DIST_PATH = "/system/@ANDROID_PACKAGE_NAME@/distribution"; const SYSTEM_DIST_PATH = "/system/@ANDROID_PACKAGE_NAME@/distribution";
@ -67,16 +67,16 @@ DirectoryProvider.prototype = {
if (env.exists(ENVVAR_UPDATE_DIR)) { if (env.exists(ENVVAR_UPDATE_DIR)) {
let path = env.get(ENVVAR_UPDATE_DIR); let path = env.get(ENVVAR_UPDATE_DIR);
if (path) { if (path) {
let localFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile); return new FileUtils.File(path);
localFile.initWithPath(path);
return localFile;
} }
} }
let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager); return new FileUtils.File(env.get("DOWNLOADS_DIRECTORY"));
return dm.defaultDownloadsDirectory;
} else if (prop == DOWNLOAD_DIR) { } else if (prop == DOWNLOAD_DIR) {
let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager); // Downloads.getSystemDownloadsDirectory is asynchronous, but getFile is
return dm.defaultDownloadsDirectory; // synchronous, so just return what the getSystemDownloadsDirectory
// implementation would have returned.
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
return new FileUtils.File(env.get("DOWNLOADS_DIRECTORY"));
} }
// We are retuning null to show failure instead for throwing an error. The // We are retuning null to show failure instead for throwing an error. The