Changeset 24556 for trunk/magic/remove/src/streaksremove.c
- Timestamp:
- Jun 25, 2009, 1:53:26 PM (17 years ago)
- File:
-
- 1 edited
-
trunk/magic/remove/src/streaksremove.c (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/magic/remove/src/streaksremove.c
r24286 r24556 41 41 Streaks *streaks = readStreaksFile(streaksFileName); 42 42 if (!streaks) { 43 psError StackPrint(stderr, "failed to read streaks file: %s", streaksFileName);43 psError(PS_ERR_UNKNOWN, "failed to read streaks file: %s", streaksFileName); 44 44 streaksExit("", PS_EXIT_PROG_ERROR); 45 45 } … … 209 209 if (!replicateOutputs(sfiles)) { 210 210 psError(PS_ERR_UNKNOWN, false, "failed to replicate output files"); 211 deleteTemps(sfiles); 211 212 psErrorStackPrint(stderr, ""); 212 213 exit(PS_EXIT_UNKNOWN_ERROR); … … 215 216 // NOTE: from here on we can't just quit if something goes wrong. 216 217 // especially if we're working at the raw stage 218 // turn off automatic deletion of output files by streaksExit 219 setStreakFiles(NULL); 217 220 218 221 if (psMetadataLookupBool(&status, config->arguments, "REPLACE")) { … … 220 223 // Note this is a nebulous database operation. No file I/O is performed 221 224 if (!swapOutputsToInputs(sfiles)) { 222 psError(PS_ERR_UNKNOWN, false, "failed to swap files"); 223 224 // XXX: Now what? I guess swapOutputsToInputs will need to undo anything that 225 // it has done and give a detailed report of what happened 226 227 psErrorStackPrint(stderr, ""); 225 // XXX: Now what? 226 // It is up to the program that reverts failed destreak runs to insure that 227 // any input files that have been swapped are restored 228 229 psErrorStackPrint(stderr, "failed to swap files"); 228 230 229 231 // XXX: pick a specific error code for this failure 230 232 exit(PS_EXIT_UNKNOWN_ERROR); 231 233 } 232 233 #ifdef notdef234 // XXX: we've decided to not do the remove step here235 // Instead we leave the backup images (the original images) in place and remove them236 // later on237 if (psMetadataLookupBool(&status, config->arguments, "REMOVE")) {238 // delete the temporary storage objects (which now points to the original image(s)239 if (!deleteTemps(sfiles)) {240 psError(PS_ERR_UNKNOWN, false, "failed to delete temporary files");241 // XXX: Now what? At this point the output files have been swapped, so we can't242 // repeat the operation.243 244 // Returning error status here is problematic. The inputs have been streak removed245 // but they're still lying around246 // Maybe just print an error message and247 // let other system tools clean up248 psErrorStackPrint(stderr, "");249 exit(PS_EXIT_UNKNOWN_ERROR);250 }251 }252 #endif253 254 234 } 255 235 // all done. Clean up to look for memory leaks. … … 446 426 usage(); 447 427 } 448 psString dir = pathToDirectory(argv[argnum]); 449 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "directory for temporary files", 450 dir); 451 psFree(dir); 428 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "OUTPUT", 0, "path for (temporary if replae) output files", 429 argv[argnum]); 452 430 psArgumentRemove(argnum, &argc, argv); 453 431 } else { … … 458 436 if ((argnum = psArgumentGet(argc, argv, "-recovery"))) { 459 437 psArgumentRemove(argnum, &argc, argv); 460 psString dir = pathToDirectory(argv[argnum]); 461 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "RECOVERY", 0, "directory for recovery files", 462 dir); 463 psFree(dir); 438 psMetadataAddStr(config->arguments, PS_LIST_TAIL, "RECOVERY", 0, "path for recovery files", 439 argv[argnum]); 464 440 psArgumentRemove(argnum, &argc, argv); 465 441 } else if ((stage == IPP_STAGE_RAW) && gotReplace) { … … 467 443 usage(); 468 444 } 469 470 #ifdef notdef471 // This parameter is no longer supported472 if ((argnum = psArgumentGet(argc, argv, "-remove"))) {473 if (!gotReplace) {474 psError(PS_ERR_UNKNOWN, true, "-replace is required with -remove\n");475 usage();476 }477 psArgumentRemove(argnum, &argc, argv);478 psMetadataAddBool(config->arguments, PS_LIST_TAIL, "REMOVE", 0, "remove original files",479 true);480 }481 #endif482 445 483 446 if (argc != 1) {
Note:
See TracChangeset
for help on using the changeset viewer.
