Ignore:
Timestamp:
12/07/22 13:42:55 (19 months ago)
Author:
jderouillat
Message:

Add the ability to specify the location of iodef through an environment variable XIOS_IODEF_PATH.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • XIOS2/trunk/src/cxios.cpp

    r2428 r2439  
    77#include <boost/functional/hash.hpp> 
    88#include "mpi.hpp" 
     9#include <unistd.h> 
    910#include "memory.hpp" 
    1011#include <new> 
     
    5253  { 
    5354    set_new_handler(noMemory); 
     55    char startPath[256]; 
     56    getcwd(startPath, sizeof(startPath)); 
     57    if(const char* userPath = std::getenv("XIOS_IODEF_PATH")) 
     58    { 
     59      if ( chdir( userPath ) != 0) 
     60      { 
     61        ERROR("CXios::initialize()", << "XIOS_IODEF_PATH not defined correctly : " << userPath << endl ); 
     62      } 
     63    } 
    5464    parseFile(rootFile); 
    5565    parseXiosConfig(); 
     66    chdir( startPath ); 
    5667  } 
    5768 
     
    174185    std::set<StdString> parseList; 
    175186    parseList.insert("xios"); 
     187    char startPath[256]; 
     188    getcwd(startPath, sizeof(startPath)); 
     189    if(const char* userPath = std::getenv("XIOS_IODEF_PATH")) 
     190    { 
     191      if ( chdir( userPath ) != 0) 
     192      { 
     193        ERROR("CXios::initialize()", << "XIOS_IODEF_PATH not defined correctly : " << userPath << endl ); 
     194      } 
     195    } 
    176196    xml::CXMLParser::ParseFile(rootFile, parseList); 
    177197    parseXiosConfig(); 
     198    chdir( startPath ); 
    178199  } 
    179200 
Note: See TracChangeset for help on using the changeset viewer.