IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Dec 3, 2006, 8:48:10 AM (19 years ago)
Author:
magnier
Message:

defined pmConfigConvertFilename, added to all I/O functions

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/psModules/src/camera/pmFPAfileDefine.c

    r9950 r10421  
    277277    }
    278278
     279    psString realName = pmConfigConvertFilename (infiles->data[0], config);
     280    if (!realName) {
     281        psError(PS_ERR_IO, false, "Failed to convert file name %s\n", (char *) infiles->data[0]);
     282        return NULL;
     283    }
     284
    279285    // load the header of the first image
    280     fits = psFitsOpen (infiles->data[0], "r");
     286    fits = psFitsOpen (realName, "r");
     287    if (!fits) {
     288        psError(PS_ERR_IO, false, "Failed to open file %s\n", realName);
     289        psFree (realName);
     290        return NULL;
     291    }
    281292    phu = psFitsReadHeader (NULL, fits);
     293    if (!phu) {
     294        psError(PS_ERR_IO, false, "Failed to read file header %s\n", realName);
     295        psFree (realName);
     296        return NULL;
     297    }
    282298    psFitsClose (fits);
    283299
     
    286302    format = pmConfigCameraFormatFromHeader (config, phu);
    287303    if (!format) {
    288         psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", (char *)infiles->data[0]);
     304        psError(PS_ERR_IO, false, "Failed to read CCD format from %s\n", realName);
    289305        psFree(phu);
     306        psFree (realName);
    290307        return NULL;
    291308    }
     
    294311    fpa = pmFPAConstruct (config->camera);
    295312    if (!fpa) {
    296         psError(PS_ERR_IO, false, "Failed to construct FPA from %s", (char *)infiles->data[0]);
    297         return NULL;
    298     }
     313        psError(PS_ERR_IO, false, "Failed to construct FPA from %s", realName);
     314        psFree (realName);
     315        return NULL;
     316    }
     317    psFree (realName);
    299318
    300319    // load the given filerule (from config->camera) and bind it to the fpa
     
    337356    for (int i = 0; i < infiles->n; i++) {
    338357        if (i > 0) {
    339             fits = psFitsOpen (infiles->data[i], "r");
     358            psString realName = pmConfigConvertFilename (infiles->data[i], config);
     359            if (!realName) {
     360                psError(PS_ERR_IO, false, "Failed to convert file name %s", (char *) infiles->data[i]);
     361                return NULL;
     362            }
     363            fits = psFitsOpen (realName, "r");
     364            if (!fits) {
     365                psError(PS_ERR_IO, false, "Failed to open file %s\n", realName);
     366                psFree (realName);
     367                return NULL;
     368            }
    340369            phu = psFitsReadHeader (NULL, fits);
    341             pmConfigValidateCameraFormat (format, phu);
     370            if (!phu) {
     371                psError(PS_ERR_IO, false, "Failed to read file header %s", realName);
     372                psFree (realName);
     373                psFitsClose (fits);
     374                return NULL;
     375            }
     376            if (!pmConfigValidateCameraFormat (format, phu)) {
     377                psError(PS_ERR_IO, false, "file %s is not from the required camera", realName);
     378                psFree (realName);
     379                psFitsClose (fits);
     380                return NULL;
     381            }
    342382            psFitsClose (fits);
    343383        }
     
    545585
    546586    // Prepend the global path to the file rule
    547     if (config->workdir) {
    548         psStringPrepend(&file->filerule, "%s/", config->workdir);
    549     }
     587    psString tmpName = pmConfigConvertFilename (file->filerule, config);
     588    psFree (file->filerule);
     589    file->filerule = tmpName;
    550590
    551591    if (found) {
Note: See TracChangeset for help on using the changeset viewer.