mirror of
https://github.com/fadden/nulib2.git
synced 2024-12-27 02:31:49 +00:00
Add arg to exerciser "af"
Updated the NuAddFile command to take an extra argument that identifies the source as coming from a resource fork. You can't actually use this to create a forked entry without some behind- the-scenes renaming, because the exerciser uses the disk filename as the storage filename, and the "add file" code won't be able to match the entries up.
This commit is contained in:
parent
8d2f1a5479
commit
ae8eec5d1b
@ -364,13 +364,25 @@ static NuError AbortFunc(ExerciserState* pState, int argc, char** argv)
|
||||
static NuError AddFileFunc(ExerciserState* pState, int argc, char** argv)
|
||||
{
|
||||
NuFileDetails nuFileDetails;
|
||||
int fromRsrc = false;
|
||||
|
||||
(void) pState, (void) argc, (void) argv; /* shut up, gcc */
|
||||
assert(ExerciserState_GetNuArchive(pState) != NULL);
|
||||
assert(argc == 2);
|
||||
assert(argc == 3);
|
||||
|
||||
if (strcasecmp(argv[2], "true") == 0) {
|
||||
fromRsrc = true;
|
||||
} else if (strcasecmp(argv[2], "false") != 0) {
|
||||
fprintf(stderr, "WARNING: fromRsrc should be 'true' or 'false'\n");
|
||||
/* ignore */
|
||||
}
|
||||
|
||||
memset(&nuFileDetails, 0, sizeof(nuFileDetails));
|
||||
nuFileDetails.threadID = kNuThreadIDDataFork;
|
||||
if (fromRsrc) {
|
||||
nuFileDetails.threadID = kNuThreadIDRsrcFork;
|
||||
} else {
|
||||
nuFileDetails.threadID = kNuThreadIDDataFork;
|
||||
}
|
||||
nuFileDetails.storageNameMOR = argv[1];
|
||||
nuFileDetails.fileSysID = kNuFileSysUnknown;
|
||||
nuFileDetails.fileSysInfo = (short) kFssep;
|
||||
@ -378,7 +390,7 @@ static NuError AddFileFunc(ExerciserState* pState, int argc, char** argv)
|
||||
/* fileType, extraType, storageType, dates */
|
||||
|
||||
return NuAddFile(ExerciserState_GetNuArchive(pState), argv[1],
|
||||
&nuFileDetails, false, NULL);
|
||||
&nuFileDetails, fromRsrc, NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1039,7 +1051,7 @@ static const struct {
|
||||
|
||||
{ "ab", AbortFunc, 0, "", kFlagArchiveReq,
|
||||
"Abort current changes" },
|
||||
{ "af", AddFileFunc, 1, "filename", kFlagArchiveReq,
|
||||
{ "af", AddFileFunc, 2, "filename fromRsrc", kFlagArchiveReq,
|
||||
"Add file" },
|
||||
{ "ar", AddRecordFunc, 1, "storageName", kFlagArchiveReq,
|
||||
"Add record" },
|
||||
|
Loading…
Reference in New Issue
Block a user