зеркало из https://github.com/mozilla/gecko-dev.git
Bug 491436 - Some logging improvements to update service. r=rstrong
This commit is contained in:
Родитель
53bfe072d4
Коммит
901715d2d8
|
@ -363,8 +363,11 @@ function getUpdatesDir(key) {
|
|||
}
|
||||
updateDir.append(DIR_UPDATES);
|
||||
updateDir.append("0");
|
||||
if (!updateDir.exists() && !key)
|
||||
if (!updateDir.exists() && !key) {
|
||||
LOG("General", "getUpdatesDir - update directory " + updateDir.path +
|
||||
" doesn't exist, creating...");
|
||||
updateDir.create(Ci.nsILocalFile.DIRECTORY_TYPE, PERMS_DIRECTORY);
|
||||
}
|
||||
return updateDir;
|
||||
}
|
||||
|
||||
|
@ -378,8 +381,10 @@ function getUpdatesDir(key) {
|
|||
function readStatusFile(dir) {
|
||||
var statusFile = dir.clone();
|
||||
statusFile.append(FILE_UPDATE_STATUS);
|
||||
LOG("General", "readStatusFile - Reading Status File: " + statusFile.path);
|
||||
return readStringFromFile(statusFile) || STATE_NONE;
|
||||
var status = readStringFromFile(statusFile) || STATE_NONE;
|
||||
LOG("General", "readStatusFile - status: " + status + ", path: " +
|
||||
statusFile.path);
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -470,6 +475,8 @@ function cleanUpUpdatesDir(key) {
|
|||
updateDir.path + " - This is almost always bad. Exception = " + e);
|
||||
throw e;
|
||||
}
|
||||
LOG("General", "cleanUpUpdatesDir - successfully removed update directory: " +
|
||||
updateDir.path);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -640,8 +647,10 @@ function readStringFromFile(file) {
|
|||
var fis = Cc["@mozilla.org/network/file-input-stream;1"].
|
||||
createInstance(Ci.nsIFileInputStream);
|
||||
var modeFlags = MODE_RDONLY;
|
||||
if (!file.exists())
|
||||
if (!file.exists()) {
|
||||
LOG("General", "readStringFromFile - file doesn't exist: " + file.path);
|
||||
return null;
|
||||
}
|
||||
fis.init(file, modeFlags, PERMS_FILE, 0);
|
||||
var sis = Cc["@mozilla.org/scriptableinputstream;1"].
|
||||
createInstance(Ci.nsIScriptableInputStream);
|
||||
|
|
Загрузка…
Ссылка в новой задаче