Make Install.execute() work on Unix.

[nsbeta2+ b = 37168; r = ssu]
This commit is contained in:
sgehani%netscape.com 2000-07-10 21:02:16 +00:00
Родитель 7b0693f2ad
Коммит ddd08b30b6
3 изменённых файлов: 37 добавлений и 32 удалений

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

@ -138,51 +138,54 @@ PRInt32 ReplaceExistingWindowsFile(nsIFile* currentSpec, nsIFile* finalSpec)
PRInt32 DeleteFileNowOrSchedule(nsIFile* filename)
{
PRBool flagExists;
PRInt32 result = nsInstall::SUCCESS;
PRBool flagExists;
PRInt32 result = nsInstall::SUCCESS;
filename->Delete(PR_FALSE);
filename->Exists(&flagExists);
if (flagExists)
result = ScheduleFileForDeletion(filename);
return result;
}
PRInt32 ScheduleFileForDeletion(nsIFile *filename)
{
// could not delete, schedule it for later
RKEY newkey;
HREG reg;
REGERR err;
PRInt32 result = nsInstall::UNEXPECTED_ERROR;
err = NR_RegOpen("", &reg) ;
if ( err == REGERR_OK )
{
// could not delete, schedule it for later
RKEY newkey;
HREG reg;
REGERR err;
result = nsInstall::UNEXPECTED_ERROR;
err = NR_RegOpen("", &reg) ;
err = NR_RegAddKey(reg,ROOTKEY_PRIVATE,REG_DELETE_LIST_KEY,&newkey);
if ( err == REGERR_OK )
{
err = NR_RegAddKey(reg,ROOTKEY_PRIVATE,REG_DELETE_LIST_KEY,&newkey);
char valname[20];
char* fnamestr = nsnull;
err = NR_RegGetUniqueName( reg, valname, sizeof(valname) );
if ( err == REGERR_OK )
{
char valname[20];
char* fnamestr = nsnull;
err = NR_RegGetUniqueName( reg, valname, sizeof(valname) );
if ( err == REGERR_OK )
nsresult rv;
rv = GetPersistentStringFromSpec( filename, &fnamestr );
if ( NS_SUCCEEDED(rv) && fnamestr )
{
nsresult rv;
rv = GetPersistentStringFromSpec( filename, &fnamestr );
if ( NS_SUCCEEDED(rv) && fnamestr )
{
err = NR_RegSetEntry( reg, newkey, valname,
REGTYPE_ENTRY_BYTES,
(void*)fnamestr,
strlen(fnamestr)+1);
err = NR_RegSetEntry( reg, newkey, valname,
REGTYPE_ENTRY_BYTES,
(void*)fnamestr,
strlen(fnamestr)+1);
if ( err == REGERR_OK )
result = nsInstall::REBOOT_NEEDED;
}
if ( err == REGERR_OK )
result = nsInstall::REBOOT_NEEDED;
}
}
NR_RegClose(reg);
}
NR_RegClose(reg);
}
return result;

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

@ -21,6 +21,7 @@
* Contributor(s):
* Daniel Veditz <dveditz@netscape.com>
* Douglas Turner <dougt@netscape.com>
* Samir Gehani <sgehani@netscape.com>
*/
#ifndef __SCHEDULEDTASKS_H__
@ -36,6 +37,7 @@ PR_BEGIN_EXTERN_C
PRInt32 DeleteFileNowOrSchedule(nsIFile* filename);
PRInt32 ReplaceFileNowOrSchedule(nsIFile* tmpfile, nsIFile* target );
PRInt32 ScheduleFileForDeletion(nsIFile* filename);
void PerformScheduledTasks(HREG reg);

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

@ -105,7 +105,7 @@ PRInt32 nsInstallExecute::Complete()
if(cArgs[0])
delete(cArgs[0]);
DeleteFileNowOrSchedule( app );
ScheduleFileForDeletion( app );
return result;
}