IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Jun 25, 2009, 1:53:26 PM (17 years ago)
Author:
bills
Message:

various changes to insure that we don't delete non-destreked files by mistake

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/magic/remove/src/streaksremove.c

    r24286 r24556  
    4141    Streaks *streaks = readStreaksFile(streaksFileName);
    4242    if (!streaks) {
    43         psErrorStackPrint(stderr, "failed to read streaks file: %s", streaksFileName);
     43        psError(PS_ERR_UNKNOWN, "failed to read streaks file: %s", streaksFileName);
    4444        streaksExit("", PS_EXIT_PROG_ERROR);
    4545    }
     
    209209    if (!replicateOutputs(sfiles)) {
    210210        psError(PS_ERR_UNKNOWN, false, "failed to replicate output files");
     211        deleteTemps(sfiles);
    211212        psErrorStackPrint(stderr, "");
    212213        exit(PS_EXIT_UNKNOWN_ERROR);
     
    215216    // NOTE: from here on we can't just quit if something goes wrong.
    216217    // especially if we're working at the raw stage
     218    // turn off automatic deletion of output files by streaksExit
     219    setStreakFiles(NULL);
    217220
    218221    if (psMetadataLookupBool(&status, config->arguments, "REPLACE")) {
     
    220223        //     Note this is a nebulous database operation. No file I/O is performed
    221224        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");
    228230
    229231            // XXX: pick a specific error code for this failure
    230232            exit(PS_EXIT_UNKNOWN_ERROR);
    231233        }
    232 
    233 #ifdef notdef
    234         // XXX: we've decided to not do the remove step here
    235         // Instead we leave the backup images (the original images) in place and remove them
    236         // later on
    237         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't
    242                 // repeat the operation.
    243 
    244                 // Returning error status here is problematic. The inputs have been streak removed
    245                 // but they're still lying around
    246                 // Maybe just print an error message and
    247                 // let other system tools clean up
    248                 psErrorStackPrint(stderr, "");
    249                 exit(PS_EXIT_UNKNOWN_ERROR);
    250             }
    251         }
    252 #endif
    253 
    254234    }
    255235    // all done. Clean up to look for memory leaks.
     
    446426            usage();
    447427        }
    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]);
    452430        psArgumentRemove(argnum, &argc, argv);
    453431    } else {
     
    458436    if ((argnum = psArgumentGet(argc, argv, "-recovery"))) {
    459437        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]);
    464440        psArgumentRemove(argnum, &argc, argv);
    465441    } else if ((stage == IPP_STAGE_RAW) && gotReplace) {
     
    467443        usage();
    468444    }
    469 
    470 #ifdef notdef
    471     // This parameter is no longer supported
    472     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 #endif
    482445
    483446    if (argc != 1) {
Note: See TracChangeset for help on using the changeset viewer.