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

Add the ability to specify the location of iodef through an environment variable XIOS_IODEF_PATH. Included XML sources can integrates environment variables

File:
1 edited

Legend:

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

    r2420 r2438  
    1515#include "servers_ressource.hpp" 
    1616#include "mem_checker.hpp" 
     17#include <unistd.h> 
    1718 
    1819namespace xios 
     
    7172  { 
    7273    set_new_handler(noMemory); 
     74    char startPath[256]; 
     75    getcwd(startPath, sizeof(startPath)); 
     76    if(const char* userPath = std::getenv("XIOS_IODEF_PATH")) 
     77    { 
     78      if ( chdir( userPath ) != 0) 
     79      { 
     80        ERROR("CXios::initialize()", << "XIOS_IODEF_PATH not defined correctly : " << userPath << endl ); 
     81      } 
     82    } 
    7383    parseFile(rootFile); 
    7484    parseXiosConfig(); 
     85    chdir( startPath ); 
    7586  } 
    7687 
     
    199210    std::set<StdString> parseList; 
    200211    parseList.insert("xios"); 
     212    char startPath[256]; 
     213    getcwd(startPath, sizeof(startPath)); 
     214    if(const char* userPath = std::getenv("XIOS_IODEF_PATH")) 
     215    { 
     216      if ( chdir( userPath ) != 0) 
     217      { 
     218        ERROR("CXios::initialize()", << "XIOS_IODEF_PATH not defined correctly : " << userPath << endl ); 
     219      } 
     220    } 
    201221    xml::CXMLParser::ParseFile(rootFile, parseList); 
    202222    parseXiosConfig(); 
     223    chdir( startPath ); 
    203224  } 
    204225 
Note: See TracChangeset for help on using the changeset viewer.