Changeset 7408


Ignore:
Timestamp:
05/03/18 11:50:30 (6 months ago)
Author:
alexander
Message:

added fix for missing PickIndexDir? to try and create it if specified and it doesnt exist

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/seismic_processing/pick_ew/config.c

    r7279 r7408  
    77 *    Revision history: 
    88 *     $Log$ 
     9 *     Revision 1.7  2018/05/03 11:32:33  alexander 
     10 *     Adding fix to create PickIndexDir if specified and it doesn't exist 
     11 * 
    912 *     Revision 1.6  2008/03/28 18:20:31  paulf 
    1013 *     added in PickIndexDir option to specify where pick indexes get stuffed 
     
    3437#include <stdlib.h> 
    3538#include <string.h> 
     39 
     40#if defined (_WINNT) 
     41 #include <direct.h> 
     42#else 
     43 #include <unistd.h> 
     44#endif 
     45 
    3646 
    3747#include "earthworm.h" 
     
    206216         { 
    207217            Gparm->PickIndexDir = strdup(k_str()); 
     218 
     219            if(access(Gparm->PickIndexDir, F_OK) == -1) { 
     220               //go ahead and attempt to create the directory: 
     221#if defined(_WINNT) 
     222               //POSIX-compliant 'mkdir' is deprecated on Windows: 
     223               if(_mkdir(Gparm->PickIndexDir) == -1) { 
     224                  //Give up and go home: 
     225                  free(Gparm->PickIndexDir); 
     226                  Gparm->PickIndexDir = NULL; 
     227               } 
     228#else 
     229               if(mkdir(Gparm->PickIndexDir, 0700) == -1) { 
     230                  //Give up and go home: 
     231                  free(Gparm->PickIndexDir); 
     232                  Gparm->PickIndexDir = NULL; 
     233               } 
     234#endif 
     235            } 
    208236         } 
    209237 
Note: See TracChangeset for help on using the changeset viewer.