Added "original pathname" fields to NuFileDetails and NuErrorStatus.

Changed callback setters to return NuCallback instead of NuError.
This commit is contained in:
Andy McFadden 2003-02-18 21:43:46 +00:00
parent f75f26b69b
commit 56a96dc7eb
5 changed files with 45 additions and 14 deletions

View File

@ -1,3 +1,7 @@
2003/02/18 fadden
- Added "original pathname" fields to NuFileDetails and NuErrorStatus.
- Changed callback setters to return NuCallback instead of NuError.
2003/02/08 fadden
- Upped version to v2.0.0.
- Changed DataSource API. Removed "doClose" and added an optional

View File

@ -750,9 +750,24 @@ Nu_HandleAddThreadMods(NuArchive* pArchive, NuRecord* pRecord,
* reading the data out of. We could do this differently
* for a "file" data source, but we might as well be
* consistent.
*
* [Actually, the above remark is bogus. During a bulk add
* there's no other way to recover the original filename.
* Do something different here for data sinks with
* filenames attached. ++ATM 2003/02/17]
*/
err = Nu_ProgressDataInit_Compress(pArchive, &progressData,
pRecord, pRecord->filename);
if (Nu_DataSourceGetType(pThreadMod->entry.add.pDataSource)
== kNuDataSourceFromFile)
{
/* use on-disk filename */
err = Nu_ProgressDataInit_Compress(pArchive, &progressData,
pRecord, Nu_DataSourceFile_GetPathname(
pThreadMod->entry.add.pDataSource));
} else {
/* use archive filename for both */
err = Nu_ProgressDataInit_Compress(pArchive, &progressData,
pRecord, pRecord->filename);
}
BailError(err);
/* send initial progress so they see name if "open" fails */

View File

@ -719,6 +719,7 @@ Nu_OpenOutputFile(NuArchive* pArchive, const NuRecord* pRecord,
errorStatus.message = nil;
errorStatus.pRecord = pRecord;
errorStatus.pathname = newPathname;
errorStatus.origPathname = nil;
errorStatus.filenameSeparator = newFssep;
/*errorStatus.origArchiveTouched = false;*/
errorStatus.canAbort = true;
@ -1021,6 +1022,7 @@ retry:
errorStatus.message = nil;
errorStatus.pRecord = nil;
errorStatus.pathname = pathname;
errorStatus.origPathname = nil;
errorStatus.filenameSeparator = '\0';
/*errorStatus.origArchiveTouched = false;*/
errorStatus.canAbort = true;

View File

@ -222,15 +222,18 @@ typedef enum NuFileSysID {
/* simplified definition of storage types */
typedef enum NuStorageType {
kNuStorageUnknown = 0,
kNuStorageUnknown = 0, /* (used by ProDOS for deleted files) */
kNuStorageSeedling = 1, /* <= 512 bytes */
kNuStorageSapling = 2, /* < 128KB */
kNuStorageTree = 3, /* < 16MB */
kNuStoragePascalVol = 4, /* (embedded pascal volume; rare) */
kNuStorageExtended = 5, /* forked (any size) */
kNuStorageDirectory = 0x0d
kNuStorageDirectory = 13, /* directory */
kNuStorageSubdirHeader = 14, /* (only used in subdir headers) */
kNuStorageVolumeHeader = 15, /* (only used in volume dir header) */
} NuStorageType;
/* flags for NuOpenRW */
/* bit flags for NuOpenRW */
enum {
kNuOpenCreat = 0x0001,
kNuOpenExcl = 0x0002
@ -514,6 +517,7 @@ typedef struct NuRecordAttr {
typedef struct NuFileDetails {
/* used during AddFile call */
NuThreadID threadID; /* data, rsrc, disk img? */
const char* origName;
/* these go straight into the NuRecord */
const char* storageName;
@ -634,8 +638,9 @@ typedef struct NuErrorStatus {
int sysErr; /* system error code, if applicable */
const char* message; /* (optional) message to user */
const NuRecord* pRecord; /* relevant record, if any */
const char* pathname; /* relevant pathname, if any */
char filenameSeparator; /* fssep for this path, if any */
const char* pathname; /* problematic pathname, if any */
const char* origPathname; /* original pathname, if any */
char filenameSeparator; /* fssep for pathname, if any */
/*char origArchiveTouched;*/
char canAbort; /* give option to abort */
@ -803,17 +808,20 @@ NUFXLIB_API short NuIsPresizedThreadID(NuThreadID threadID);
/* callback setters */
NUFXLIB_API NuError NuSetSelectionFilter(NuArchive* pArchive,
#define kNuInvalidCallback ((NuCallback) 1)
NUFXLIB_API NuCallback NuSetSelectionFilter(NuArchive* pArchive,
NuCallback filterFunc);
NUFXLIB_API NuError NuSetOutputPathnameFilter(NuArchive* pArchive,
NUFXLIB_API NuCallback NuSetOutputPathnameFilter(NuArchive* pArchive,
NuCallback filterFunc);
NUFXLIB_API NuError NuSetProgressUpdater(NuArchive* pArchive,
NUFXLIB_API NuCallback NuSetProgressUpdater(NuArchive* pArchive,
NuCallback updateFunc);
NUFXLIB_API NuError NuSetFreeHandler(NuArchive* pArchive, NuCallback freeFunc);
NUFXLIB_API NuError NuSetErrorHandler(NuArchive* pArchive,NuCallback errorFunc);
NUFXLIB_API NuError NuSetErrorMessageHandler(NuArchive* pArchive,
NUFXLIB_API NuCallback NuSetFreeHandler(NuArchive* pArchive,
NuCallback freeFunc);
NUFXLIB_API NuCallback NuSetErrorHandler(NuArchive* pArchive,
NuCallback errorFunc);
NUFXLIB_API NuCallback NuSetErrorMessageHandler(NuArchive* pArchive,
NuCallback messageHandlerFunc);
NUFXLIB_API NuError NuSetGlobalErrorMessageHandler(NuCallback messageHandlerFunc);
NUFXLIB_API NuCallback NuSetGlobalErrorMessageHandler(NuCallback messageHandlerFunc);
#ifdef __cplusplus

View File

@ -810,6 +810,7 @@ Nu_ShouldIgnoreBadCRC(NuArchive* pArchive, const NuRecord* pRecord, NuError err)
errorStatus.message = nil;
errorStatus.pRecord = pRecord;
errorStatus.pathname = nil;
errorStatus.origPathname = nil;
errorStatus.filenameSeparator = 0;
if (pRecord != nil) {
errorStatus.pathname = pRecord->filename;
@ -2044,6 +2045,7 @@ Nu_HandleAddDuplicateRecord(NuArchive* pArchive, NuRecordSet* pRecordSet,
errorStatus.message = nil;
errorStatus.pRecord = pRecord;
errorStatus.pathname = pFileDetails->storageName;
errorStatus.origPathname = pFileDetails->origName;
errorStatus.filenameSeparator =
NuGetSepFromSysInfo(pFileDetails->fileSysInfo);
/*errorStatus.origArchiveTouched = false;*/