Bug 491436 - Some logging improvements to update service. r=rstrong

This commit is contained in:
Jeff Beckley 2009-05-19 13:24:59 -07:00
Родитель 53bfe072d4
Коммит 901715d2d8
1 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -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);