Commit 61ec9a92 authored by Håkan Wennlöf's avatar Håkan Wennlöf
Browse files

Merge branch 'b-g4-getent' into 'v3.0-stable'

[v3.0-stable] Use G4FindDataDir instead of std::getenv for G4 data set queries

See merge request allpix-squared/allpix-squared!1068
parents b6320d48 02b13185
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -93,7 +93,11 @@ GeometryBuilderGeant4Module::GeometryBuilderGeant4Module(Configuration& config,
 * @throws ModuleError If a certain Geant4 dataset is not set or not available
 */
static void check_dataset_g4(const std::string& env_name) {
#if G4VERSION_NUMBER >= 1110
    const char* file_name = G4FindDataDir(env_name.c_str());
#else
    const char* file_name = std::getenv(env_name.c_str());
#endif
    if(file_name == nullptr) {
        throw ModuleError("Geant4 environment variable " + env_name +
                          " is not set, make sure to source a Geant4 "