mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-18 06:45:33 +00:00
Bug 632170 - Use updates directory environmental variable [r=mfinkle, a=blockin-fennec]
This commit is contained in:
parent
b749c00fd3
commit
3b8c49571e
@ -45,6 +45,7 @@ Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
const NS_APP_CACHE_PARENT_DIR = "cachePDir";
|
||||
const XRE_UPDATE_ROOT_DIR = "UpdRootD";
|
||||
const ENVVAR_UPDATE_DIR = "UPDATES_DIRECTORY";
|
||||
|
||||
function DirectoryProvider() {}
|
||||
|
||||
@ -74,6 +75,15 @@ DirectoryProvider.prototype = {
|
||||
return profile;
|
||||
}
|
||||
} else if (prop == XRE_UPDATE_ROOT_DIR) {
|
||||
let env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
if (env.exists(ENVVAR_UPDATE_DIR)) {
|
||||
let path = env.get(ENVVAR_UPDATE_DIR);
|
||||
if (path) {
|
||||
let localFile = Cc["@mozilla.org/file/local;1"].createInstance(Ci.nsILocalFile);
|
||||
localFile.initWithPath(path);
|
||||
return localFile;
|
||||
}
|
||||
}
|
||||
let dm = Cc["@mozilla.org/download-manager;1"].getService(Ci.nsIDownloadManager);
|
||||
return dm.defaultDownloadsDirectory;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user