fixes bug 309183 "Software update fails if user lacks write permissions on the 'update' folder/directory" patch by Ben Turner (bent.mozilla@gmail.com), r=darin

This commit is contained in:
darin%meer.net 2005-09-28 01:33:47 +00:00
parent 3a6bb4abe9
commit 3d25eb56cf

View File

@ -1166,10 +1166,17 @@ UpdateService.prototype = {
*/
get canUpdate() {
try {
var file = getFile(KEY_APPDIR, [FILE_PERMS_TEST]);
if (!file.exists()) {
file.create(nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
file.remove(false);
var appDirFile = getFile(KEY_APPDIR, [FILE_PERMS_TEST]);
if (!appDirFile.exists()) {
appDirFile.create(nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
appDirFile.remove(false);
}
var updateDir = getUpdatesDir();
var upDirFile = updateDir.clone();
upDirFile.append(FILE_PERMS_TEST);
if (!upDirFile.exists()) {
upDirFile.create(nsILocalFile.NORMAL_FILE_TYPE, PERMS_FILE);
upDirFile.remove(false);
}
}
catch (e) {