зеркало из https://github.com/mozilla/pjs.git
Fix for nsbeta2+ bug 340786 r=sgehani
This commit is contained in:
Родитель
7c32978baa
Коммит
ab4a91d271
|
@ -457,54 +457,52 @@ void ReplaceScheduledFiles( HREG reg )
|
||||||
nsCOMPtr<nsILocalFile> dest;
|
nsCOMPtr<nsILocalFile> dest;
|
||||||
nsresult rv1, rv2;
|
nsresult rv1, rv2;
|
||||||
|
|
||||||
rv1 = NS_NewLocalFile("", getter_AddRefs(src));
|
memset(srcFile, 0, sizeof(srcFile));
|
||||||
rv2 = NS_NewLocalFile("", getter_AddRefs(dest));
|
memset(doomedFile, 0, sizeof(doomedFile));
|
||||||
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2))
|
|
||||||
|
uint32 bufsize;
|
||||||
|
REGENUM state = 0;
|
||||||
|
while (REGERR_OK == NR_RegEnumSubkeys( reg, key, &state,
|
||||||
|
keyname, sizeof(keyname), REGENUM_CHILDREN))
|
||||||
{
|
{
|
||||||
uint32 bufsize;
|
bufsize = sizeof(srcFile);
|
||||||
REGENUM state = 0;
|
REGERR err1 = NR_RegGetEntry( reg, (RKEY)state,
|
||||||
while (REGERR_OK == NR_RegEnumSubkeys( reg, key, &state,
|
REG_REPLACE_SRCFILE, srcFile, &bufsize);
|
||||||
keyname, sizeof(keyname), REGENUM_CHILDREN))
|
|
||||||
|
bufsize = sizeof(doomedFile);
|
||||||
|
REGERR err2 = NR_RegGetEntry( reg, (RKEY)state,
|
||||||
|
REG_REPLACE_DESTFILE, doomedFile, &bufsize);
|
||||||
|
|
||||||
|
if ( err1 == REGERR_OK && err2 == REGERR_OK )
|
||||||
{
|
{
|
||||||
bufsize = sizeof(srcFile);
|
rv1 = NS_NewLocalFile((char*)srcFile, getter_AddRefs(src));
|
||||||
REGERR err1 = NR_RegGetEntry( reg, (RKEY)state,
|
rv1 = src->Clone(getter_AddRefs(srcSpec));
|
||||||
REG_REPLACE_SRCFILE, srcFile, &bufsize);
|
|
||||||
|
|
||||||
bufsize = sizeof(doomedFile);
|
rv2 = NS_NewLocalFile((char*)doomedFile, getter_AddRefs(dest));
|
||||||
REGERR err2 = NR_RegGetEntry( reg, (RKEY)state,
|
rv2 = dest->Clone(getter_AddRefs(doomedSpec));
|
||||||
REG_REPLACE_DESTFILE, doomedFile, &bufsize);
|
|
||||||
|
|
||||||
if ( err1 == REGERR_OK && err2 == REGERR_OK )
|
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2))
|
||||||
{
|
{
|
||||||
src->InitWithPath((char*)srcFile);
|
// finally now try to do the replace
|
||||||
rv1 = src->Clone(getter_AddRefs(srcSpec));
|
PRInt32 result = ReplaceFileNow( srcSpec, doomedSpec );
|
||||||
|
|
||||||
dest->InitWithPath((char*)doomedFile);
|
if ( result == nsInstall::DOES_NOT_EXIST ||
|
||||||
rv2 = dest->Clone(getter_AddRefs(doomedSpec));
|
result == nsInstall::SUCCESS )
|
||||||
|
|
||||||
if (NS_SUCCEEDED(rv1) && NS_SUCCEEDED(rv2))
|
|
||||||
{
|
{
|
||||||
// finally now try to do the replace
|
// This one is done
|
||||||
PRInt32 result = ReplaceFileNow( srcSpec, doomedSpec );
|
NR_RegDeleteKey( reg, key, keyname );
|
||||||
|
|
||||||
if ( result == nsInstall::DOES_NOT_EXIST ||
|
|
||||||
result == nsInstall::SUCCESS )
|
|
||||||
{
|
|
||||||
// This one is done
|
|
||||||
NR_RegDeleteKey( reg, key, keyname );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* delete list node if empty */
|
/* delete list node if empty */
|
||||||
state = 0;
|
state = 0;
|
||||||
if (REGERR_NOMORE == NR_RegEnumSubkeys( reg, key, &state, keyname,
|
if (REGERR_NOMORE == NR_RegEnumSubkeys( reg, key, &state, keyname,
|
||||||
sizeof(keyname), REGENUM_CHILDREN ))
|
sizeof(keyname), REGENUM_CHILDREN ))
|
||||||
{
|
{
|
||||||
NR_RegDeleteKey(reg, ROOTKEY_PRIVATE, REG_REPLACE_LIST_KEY);
|
NR_RegDeleteKey(reg, ROOTKEY_PRIVATE, REG_REPLACE_LIST_KEY);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче