No longer delete core file if it existed before running the installer: now only deleted if downloaded. Also, cleaned up the terminal window UI.

This commit is contained in:
sgehani%netscape.com 1999-11-04 08:23:55 +00:00
parent de0bfb010f
commit 462f21b1e5
7 changed files with 82 additions and 23 deletions

View File

@ -43,12 +43,10 @@ ShowComponentsWin(void)
Str255 compDescTitle;
StringPtr selCompMsg;
Handle listBoxRect;
Rect dataBounds, listBoxFrame, viewRect, firstCellRect;
Rect dataBounds, listBoxFrame, viewRect;
short reserr;
int totalRows = 0, i, instChoice;
Point cSize;
Cell firstCell;
UInt8 hiliteVal;
Boolean bCellSelected;
GrafPtr oldPort;
GetPort(&oldPort);

View File

@ -355,7 +355,7 @@ CleanupExtractedFiles(short tgtVRefNum, long tgtDirID)
}
HUnlock(gControls->cfg->coreDir);
goto exit;
goto aurevoir;
}
HUnlock(gControls->cfg->coreDir);
@ -366,7 +366,7 @@ CleanupExtractedFiles(short tgtVRefNum, long tgtDirID)
FSpDelete( &coreFileList[i] );
}
exit:
aurevoir:
if (pcoreDir)
DisposePtr((Ptr) pcoreDir);
return err;

View File

@ -32,12 +32,15 @@ pascal void* Install(void* unused)
short vRefNum, srcVRefNum;
long dirID, srcDirID;
OSErr err;
FSSpec idiSpec, coreFileSpec, tmpSpec;
FSSpec idiSpec, coreFileSpec;
#ifdef MIW_DEBUG
FSSpec tmpSpec;
#endif
SDISTRUCT sdistruct;
Str255 pIDIfname;
StringPtr coreFile;
THz ourHZ;
Boolean isDir = false;
Boolean isDir = false, bCoreExists = false;
GrafPtr oldPort;
#ifndef MIW_DEBUG
@ -74,6 +77,7 @@ pascal void* Install(void* unused)
return (void*)nil;
}
if (!ExistArchives(srcVRefNum, srcDirID))
{
/* download location is same as extraction location */
@ -129,6 +133,8 @@ pascal void* Install(void* unused)
FSpDelete(&idiSpec);
}
else
bCoreExists = true;
/* otherwise core exists in cwd, different from extraction location */
@ -166,10 +172,13 @@ pascal void* Install(void* unused)
CleanupExtractedFiles(vRefNum, dirID);
err = FSpDelete(&coreFileSpec);
if (!bCoreExists)
{
err = FSpDelete(&coreFileSpec);
#ifdef MIW_DEBUG
if (err!=noErr) SysBeep(10);
if (err!=noErr) SysBeep(10);
#endif
}
}
if (coreFile)
@ -542,7 +551,7 @@ InitProgressBar(void)
gControls->tw->xpiProgressMsg = NULL; /* used by XPInstall progress callback */
HLock((Handle)gControls->tw->progressBar);
SetRect(&r, (*gControls->tw->progressBar)->contrlRect.left,
(*gControls->tw->progressBar)->contrlRect.top - 21,
(*gControls->tw->progressBar)->contrlRect.top - 42,
(*gControls->tw->progressBar)->contrlRect.right,
(*gControls->tw->progressBar)->contrlRect.top - 5 );
HUnlock((Handle)gControls->tw->progressBar);

View File

@ -191,8 +191,7 @@ if (err) \
#define sExtracting 23
#define sInstalling 24
#define sFileSp 25
#define sSpOfSp 26
#define sPrep2Inst 28
#define sSpOfSp 26
#define rTitleStrList 170
#define sNSInstTitle 1 /* end i18n strings */
@ -506,6 +505,7 @@ void ClearDiskSpaceMsgs(void);
char* ltoa(long);
short pstrcmp(unsigned char*, unsigned char*);
unsigned char* pstrcpy(unsigned char*, unsigned char*);
unsigned char* pstrcat(unsigned char*, unsigned char*);
void InSetupTypeContent(EventRecord *, WindowPtr);
void EnableSetupTypeWin(void);
void DisableSetupTypeWin(void);

View File

@ -661,6 +661,9 @@ pstrcpy(unsigned char* dest, unsigned char* src)
register short i;
unsigned char* origdest;
if (!dest || !src)
return nil;
origdest = dest;
len = *src;
for (i=0; i<=len; i++)
@ -673,6 +676,29 @@ pstrcpy(unsigned char* dest, unsigned char* src)
return origdest;
}
unsigned char*
pstrcat(unsigned char* dst, unsigned char* src)
{
unsigned char *origdst;
long dlen, slen;
register short i;
if (!dst || !src)
return nil;
origdst = dst;
dlen = *dst;
slen = *src;
*dst = dlen+slen;
for (i=1; i<=slen; i++)
{
*(dst+dlen+i) = *(src+i);
}
return origdst;
}
void
GetAllVInfo( unsigned char **volName, short *count)
{

View File

@ -70,7 +70,6 @@ void
ProgressMsgInit()
{
Rect r;
Str255 installingStr;
if (gControls->tw->progressMsg)
{
@ -81,14 +80,7 @@ ProgressMsgInit()
(*gControls->tw->progressMsg)->viewRect.bottom );
HUnlock((Handle)gControls->tw->progressMsg);
/* Preparing to install... */
GetIndString(installingStr, rStringList, sPrep2Inst);
EraseRect(&r);
if (installingStr[0] > 0)
TESetText(&installingStr[1], installingStr[0], gControls->tw->progressMsg);
TEUpdate(&r, gControls->tw->progressMsg);
}
bProgMsgInit = true;
@ -102,7 +94,9 @@ xpicbProgress(const char* msg, PRInt32 val, PRInt32 max)
Boolean indeterminateFlag = false;
Rect r;
Str255 installingStr, fileStr, ofStr;
char *valStr, *maxStr;
char *valStr, *maxStr, *leaf;
StringPtr pleaf = nil;
long last;
GrafPtr oldPort;
GetPort(&oldPort);
@ -136,8 +130,32 @@ xpicbProgress(const char* msg, PRInt32 val, PRInt32 max)
if (msg)
{
EraseRect(&r);
TESetText(msg, strlen(msg), gControls->tw->xpiProgressMsg);
GetIndString(installingStr, rStringList, sInstalling);
leaf = strrchr(msg, ':');
if (leaf)
{
pleaf = CToPascal(leaf+1);
pstrcat(installingStr, pleaf);
}
else
{
installingStr[0] = 1;
installingStr[1] = ' ';
}
last = installingStr[0] + 1;
if (last > 255)
last = 255;
installingStr[last] = 0;
if (installingStr[0] > 0)
TESetText(&installingStr[1], installingStr[0], gControls->tw->xpiProgressMsg);
TEUpdate(&r, gControls->tw->xpiProgressMsg);
if (pleaf)
DisposePtr((Ptr) pleaf);
}
}
}
@ -250,11 +268,19 @@ RunXPI(FSSpec& aXPI, XPI_InstallProc *xpi_installProc)
nsresult rv;
OSErr err = noErr;
long flags = 0x1000; /* XPI_NO_NEW_THREAD = 0x1000 from nsISoftwareUpdate.h */
Boolean indeterminateFlag = true;
rv = (*xpi_installProc)( aXPI, "", flags );
/* reset progress bar to barber poll */
bMaxDiscovered = false;
if (gControls->tw->progressBar)
SetControlData(gControls->tw->progressBar, kControlNoPart, kControlProgressBarIndeterminateTag,
sizeof(indeterminateFlag), (Ptr) &indeterminateFlag);
if (NS_FAILED(rv))
return -1;
return err;
}