Changeset 30298 for gs2-extensions

Show
Ignore:
Timestamp:
09.10.2015 17:26:26 (4 years ago)
Author:
jmt12
Message:

Correcting path to manifest files for use in Greenstone3. Started to think about making this Windows safe by defining path separator by OS. However calls through to perl et al will need more work

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/src/mpiimport-src/mpiimport.cpp

    r27415 r30298  
    3131#define BUFFERSIZE 512 
    3232 
     33#if defined _WIN32 || defined __CYGWIN__ 
     34const char path_sep = '\\'; 
     35#else 
     36const char path_sep = '/'; 
     37#endif 
     38 
    3339int 
    3440main ( int argc, char *argv [] ) 
     
    142148    stringstream manifestfilename_strstr; 
    143149    if (site == NULL) { 
    144       manifestfilename_strstr << gsdlhomedir << "/collect/" << collection << "/tmp/manifest." << manifest_file_count << ".xml"; 
     150      manifestfilename_strstr << gsdlhomedir << path_sep << "collect" << path_sep << collection << path_sep << "tmp" << path_sep << "manifest." << manifest_file_count << ".xml"; 
    145151    } 
    146152    else { 
    147       manifestfilename_strstr << gsdlhomedir << "/sites/" << site << "/collect/" << collection << "/tmp/manifest." << manifest_file_count << ".xml"; 
     153      manifestfilename_strstr << gsdlhomedir << path_sep << "web" << path_sep << "sites" << path_sep << site << path_sep << "collect" << path_sep << collection << path_sep << "tmp" << path_sep << "manifest." << manifest_file_count << ".xml"; 
    148154    } 
    149155 
     
    268274        // process a received job 
    269275        seconds = time(NULL); 
    270         fprintf(stderr, "[W%d:%lu] Processing: %s\n", rank, seconds, incoming, counter); 
     276        fprintf(stderr, "[W%d:%lu] Processing: %s (%d)\n", rank, seconds, incoming, counter); 
    271277        // create Greenstone import command 
    272278        // - incoming now contains the name of the manifest file to process 
     
    280286        char affinity[16] = ""; 
    281287#endif 
    282         if (site != NULL && strlen(site) > 0) 
     288 
     289    // In the commands below, need to consider Windows. In particular: 
     290    // /dev/null => NUL 
     291    // /tmp/file.log => %temp%\\file.log 
     292    // But we'll also have issues with affinity and source bash files 
     293    if (site != NULL && strlen(site) > 0) 
    283294        { 
    284295          if (gsdlhometest != NULL) 
    285296          { 
    286             sprintf(command, "%s import.pl -keepold -manifest %s -site %s %s > /tmp/gsimport-W%d-%d.log 2>&1", affinity, incoming, site, collection, rank, counter); 
     297        sprintf(command, "%s import.pl -keepold -manifest %s -site %s %s > /tmp/gsimport-W%d-%d.log 2>&1", affinity, incoming, site, collection, rank, counter); 
    287298          } 
    288299          else