* Added support for recursive extraction of arbitrarily nested files in the core_file zip archive.

This commit is contained in:
sgehani%netscape.com 1999-09-23 06:06:58 +00:00
Родитель 6363368feb
Коммит 496080c46f
8 изменённых файлов: 111 добавлений и 11 удалений

Двоичные данные
xpinstall/wizard/mac/rsrc/MacInstallWizard.rsrc

Двоичный файл не отображается.

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

@ -203,7 +203,7 @@ InComponentsContent(EventRecord* evt, WindowPtr wCurrPtr)
localPt = evt->where;
GlobalToLocal( &localPt);
if (PtInRect( localPt, &gControls->cw->compListBox))
if ((evt->what == mouseUp) && (PtInRect( localPt, &gControls->cw->compListBox)))
{
LClick(localPt, evt->modifiers, gControls->cw->compList);
SetOptInfo();

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

@ -32,6 +32,18 @@
static FSSpec coreFileList[kMaxCoreFiles];
static short currCoreFile = 0;
#define SLASHES_2_COLONS(_path) \
do { \
char *delim; \
long count = 0, len = strlen(_path); \
\
while ( (count < len) && ((delim = strchr(_path, '/')) != 0) ) \
{ \
*delim = ':'; \
count++; \
} \
} while(0)
/*-----------------------------------------------------------*
* Deflation
*-----------------------------------------------------------*/
@ -104,7 +116,9 @@ ExtractCoreFile(short tgtVRefNum, long tgtDirID)
fullPathStr = NewPtrClear(fullPathLen+1);
strncat(fullPathStr, *fullPathH, fullPathLen);
*(fullPathStr+fullPathLen) = '\0';
rv = ZIP_OpenArchive( fullPathStr, &hZip );
HUnlock(fullPathH);
DisposeHandle(fullPathH);
DisposePtr(fullPathStr);
@ -135,7 +149,13 @@ ExtractCoreFile(short tgtVRefNum, long tgtDirID)
strncat(fullPathStr, *fullPathH, fullPathLen);
strcat(fullPathStr, filename); /* tack on filename to dirpath */
*(fullPathStr+fullPathLen+strlen(filename)) = '\0';
SLASHES_2_COLONS(fullPathStr);
err = DirCreateRecursive(fullPathStr);
if (err!=noErr)
continue;
rv = ZIP_ExtractFile( hZip, filename, fullPathStr );
HUnlock(fullPathH);
DisposeHandle(fullPathH);
DisposePtr(fullPathStr);
@ -143,6 +163,7 @@ ExtractCoreFile(short tgtVRefNum, long tgtDirID)
return rv;
// AppleSingle decode if need be
SLASHES_2_COLONS(filename);
extractedFile = CToPascal(filename);
err = FSMakeFSSpec(tgtVRefNum, tgtDirID, extractedFile, &extractedFSp);
err = FSMakeFSSpec(tgtVRefNum, tgtDirID, extractedFile, &outFSp);
@ -266,6 +287,51 @@ ResolveDirs(char *fname, char *dir)
}
}
OSErr
DirCreateRecursive(char* path)
{
long count, len=strlen(path), dummyDirID;
char *delim = '\0', *pathpos = path, *currDir;
OSErr err = noErr;
StringPtr pCurrDir;
FSSpec currDirFSp;
currDir = (char*) malloc(len+1);
if ((delim=strchr(pathpos, ':'))!=0) /* skip first since it's volName */
{
for (count=0; ((count<len)&&( (delim=strchr(pathpos, ':'))!=0) ); count++)
{
currDir[0] = '\0';
strncpy(currDir, path, delim-path+1);
currDir[delim-path+1] = '\0';
pCurrDir = CToPascal(currDir);
if (pCurrDir && *pCurrDir > 0)
{
err = FSMakeFSSpec(0, 0, pCurrDir, &currDirFSp);
if (err == fnfErr)
{
err = FSpDirCreate(&currDirFSp, smSystemScript, &dummyDirID);
if (err!=noErr)
{
SysBeep(10); // XXX remove...
return err;
}
}
DisposePtr((Ptr)pCurrDir);
pathpos = delim+1;
}
}
}
if (currDir)
free(currDir);
return err;
}
OSErr
ForceMoveFile(short vRefNum, long parID, ConstStr255Param name, long newDirID)
{

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

@ -34,6 +34,11 @@ void HandleNextEvent(EventRecord* nextEvt)
HandleMouseDown(nextEvt);
break;
case mouseUp:
if (gCurrWin == kComponentsID)
InComponentsContent(nextEvt, gWPtr);
break;
case keyDown:
HandleKeyDown(nextEvt);
break;

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

@ -39,13 +39,18 @@ pascal void* Install(void* unused)
THz ourHZ;
Boolean isDir = false;
GrafPtr oldPort;
#if PRE_BETA_HACKERY == 1
/* download to user selected folder */
vRefNum = gControls->opt->vRefNum;
dirID = gControls->opt->dirID;
#else /* PRE_BETA_HACKERY */
#ifndef DEBUG
/* get "Temporary Items" folder path */
ERR_CHECK_RET(FindFolder(kOnSystemDisk, kTemporaryFolderType, kCreateFolder, &vRefNum, &dirID), (void*)0);
#else
/* for DEBUG builds dump downloaded items in "<currProcessVolume>:Temp NSInstall:" */
vRefNum = gControls->opt->vRefNum;
err = FSMakeFSSpec( vRefNum, 0, TEMP_DIR, &tmpSpec );
if (err != noErr)
@ -65,9 +70,9 @@ pascal void* Install(void* unused)
ErrorHandler();
return (void*)0;
}
}
#endif /* CORRECT_DL_LOCATION == 1 */
}
#endif /* DEBUG */
#endif /* PRE_BETA_HACKERY */
GetIndString(pIDIfname, rStringList, sTempIDIName);
@ -95,13 +100,19 @@ pascal void* Install(void* unused)
SDI_NetInstall(&sdistruct);
#endif
SetPort(oldPort);
if (gWPtr)
{
GetPort(&oldPort);
SetPort(gWPtr);
BeginUpdate(gWPtr);
DrawControls(gWPtr);
ShowLogo(true);
UpdateTerminalWin();
EndUpdate(gWPtr);
SetPort(oldPort);
}
SetZone(ourHZ);
gSDDlg = false;
@ -132,13 +143,17 @@ pascal void* Install(void* unused)
ErrorHandler();
return (void*) nil;
}
#if PRE_BETA_HACKERY == 0
/* run all .xpi's through XPInstall */
err = RunAllXPIs(vRefNum, dirID);
if (err!=noErr)
ErrorHandler();
CleanupExtractedFiles(vRefNum, dirID);
#endif
err = FSpDelete(&coreFileSpec);
if (err!=noErr) SysBeep(10); // DEBUG
}
if (coreFile)

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

@ -225,9 +225,9 @@ ShowLogo(Boolean bEraseRect)
/* draw Netscape logo */
if (logoPicH != nil)
{
logoRectH = Get1Resource('RECT', rNSLogoBox);
logoRectH = GetResource('RECT', rNSLogoBox);
reserr = ResError();
if (reserr == noErr)
if (reserr == noErr && logoRectH)
{
HLock(logoRectH);
derefd = (Rect) **((Rect**)logoRectH);
@ -244,6 +244,8 @@ ShowLogo(Boolean bEraseRect)
DrawPicture(logoPicH, &logoRect);
ReleaseResource((Handle)logoPicH);
}
ReleaseResource((Handle)logoRectH);
}
}
}
@ -460,6 +462,9 @@ ShowNavButtons(unsigned char* backTitle, unsigned char* nextTitle)
{
SetControlTitle( gControls->backB, backTitle);
ShowControl( gControls->backB);
if (gCurrWin==kWelcomeID)
HiliteControl(gControls->backB, kDisableControl);
}
if ( gControls->nextB != NULL)

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

@ -53,6 +53,8 @@ typedef Boolean (*EventProc)(const EventRecord*);
#define CFG_IS_REMOTE 0 /* if on, download remote config.ini file */
#define SDINST_IS_DLL 1 /* if on, load SDInstLib as code fragment */
#define MOZILLA 0 /* if on, draws the Mozilla logo, not NS */
#define PRE_BETA_HACKERY 1 /* if on, extracts core to selected folder
instead of Temporary Items */
/*-----------------------------------------------------------*
* defines
@ -191,8 +193,12 @@ if (err) \
#define sFolderDlgMsg 18
#define sDiskSpcAvail 19
#define sDiskSpcNeeded 20
#define sKilobytes 21
#define sKilobytes 21
#if PRE_BETA_HACKERY == 1
#define sExtracting 27
#else
#define sExtracting 23
#endif
#define sInstalling 24
#define sFileSp 25
#define sSpOfSp 26 /* end i18n strings */
@ -535,6 +541,7 @@ Boolean UnloadSDLib(CFragConnectionID *);
OSErr ExtractCoreFile(short, long);
OSErr AppleSingleDecode(FSSpecPtr, FSSpecPtr);
void ResolveDirs(char *, char*);
OSErr DirCreateRecursive(char *);
OSErr ForceMoveFile(short, long, ConstStr255Param, long);
OSErr CleanupExtractedFiles(short, long);

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

@ -164,6 +164,7 @@ InWelcomeContent(EventRecord* evt, WindowPtr wCurrPtr)
return;
}
#if 0
HLock((Handle)gControls->backB);
r = (**(gControls->backB)).contrlRect;
HUnlock((Handle)gControls->backB);
@ -177,6 +178,7 @@ InWelcomeContent(EventRecord* evt, WindowPtr wCurrPtr)
return;
}
}
#endif
HLock((Handle)gControls->nextB);
r = (**(gControls->nextB)).contrlRect;