Definition at line 94 of file G4FindDataDir.cc.
95{
96#if defined(G4MULTITHREADED)
97 static std::mutex
mutex;
98 std::lock_guard<std::mutex> lock(
mutex);
99#endif
100
101
102 if (const char *datadir = std::getenv(name))
103 return datadir;
104
105
106 if (const char *dataset = G4GetDataDir(name)) {
107
108 if (const char *basedir = std::getenv("GEANT4_DATA_DIR")) {
109 if (is_directory(basedir))
return G4FindDataDir(name, basedir, dataset);
110
111 G4Exception(
"G4FindDataDir",
"Invalid GEANT4_DATA_DIR",
JustWarning,
"The GEANT4_DATA_DIR environment variable points to an invalid directory.\n"
112 "Will try fallback locations now. Correct the variable to disable this behaviour.");
113 }
114
115
116 for (
const auto prefix : system_paths)
118 return datadir;
119 }
120
121 return nullptr;
122}
const char * G4FindDataDir(const char *)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *description)
Referenced by G4LENDBertiniGammaElectroNuclearBuilder::Build(), G4NeutronHPCapture::BuildPhysicsTable(), G4ParticleHPElastic::BuildPhysicsTable(), G4ParticleHPFission::BuildPhysicsTable(), G4ParticleHPJENDLHEData::BuildPhysicsTable(), G4ParticleHPThermalScatteringData::BuildPhysicsTable(), G4VLEPTSModel::BuildPhysicsTable(), G4IonStoppingData::BuildPhysicsVector(), G4IonStoppingData::BuildPhysicsVector(), G4INCL::NNbarToAnnihilationChannel::fillFinalState(), G4ecpssrBaseKxsModel::G4ecpssrBaseKxsModel(), G4ecpssrBaseLixsModel::G4ecpssrBaseLixsModel(), G4FindDataDir(), G4FissLib::G4FissLib(), G4LevelReader::G4LevelReader(), G4ParticleHPInelasticData::G4ParticleHPInelasticData(), G4PhotoElectricAngularGeneratorPolarized::G4PhotoElectricAngularGeneratorPolarized(), G4RadioactiveDecay::G4RadioactiveDecay(), G4NuclideTable::GenerateNuclide(), G4BoldyshevTripletModel::Initialise(), G4DNABornExcitationModel2::Initialise(), G4DNABornIonisationModel1::Initialise(), G4DNABornIonisationModel2::Initialise(), G4DNAChampionElasticModel::Initialise(), G4DNACPA100ElasticModel::Initialise(), G4DNACPA100ExcitationModel::Initialise(), G4DNACPA100IonisationModel::Initialise(), G4DNAELSEPAElasticModel::Initialise(), G4DNAEmfietzoglouIonisationModel::Initialise(), G4DNAIonElasticModel::Initialise(), G4DNARelativisticIonisationModel::Initialise(), G4DNASancheExcitationModel::Initialise(), G4JAEAElasticScatteringModel::Initialise(), G4JAEAPolarizedElasticScatteringModel::Initialise(), G4LivermoreBremsstrahlungModel::Initialise(), G4LivermoreNuclearGammaConversionModel::Initialise(), G4LivermorePolarizedComptonModel::Initialise(), G4LivermorePolarizedGammaConversionModel::Initialise(), G4LivermorePolarizedRayleighModel::Initialise(), G4LowEPComptonModel::Initialise(), G4LowEPPolarizedComptonModel::Initialise(), G4MicroElecElasticModel::Initialise(), G4MicroElecElasticModel_new::Initialise(), G4MicroElecInelasticModel::Initialise(), G4MicroElecInelasticModel_new::Initialise(), G4ANuElNucleusCcModel::InitialiseModel(), G4ANuElNucleusNcModel::InitialiseModel(), G4ANuMuNucleusCcModel::InitialiseModel(), G4ANuMuNucleusNcModel::InitialiseModel(), G4ANuTauNucleusCcModel::InitialiseModel(), G4ANuTauNucleusNcModel::InitialiseModel(), G4NuElNucleusCcModel::InitialiseModel(), G4NuElNucleusNcModel::InitialiseModel(), G4NuMuNucleusCcModel::InitialiseModel(), G4NuMuNucleusNcModel::InitialiseModel(), G4NuTauNucleusCcModel::InitialiseModel(), G4NuTauNucleusNcModel::InitialiseModel(), G4INCL::HFB::initialize(), G4DNARelativisticIonisationModel::LoadAtomicStates(), G4AugerData::LoadData(), G4FluoData::LoadData(), G4ShellData::LoadData(), G4VCrossSectionHandler::LoadData(), G4VCrossSectionHandler::LoadNonLogData(), G4FissionProductYieldDist::MakeDirectoryName(), G4INCL::PbarAtrestEntryChannel::makeMesonStar(), G4INCL::INCL::processEvent(), G4OpticalSurface::ReadCompressedFile(), G4AblaDataFile::readData(), G4OpticalSurface::ReadDichroicFile(), G4DNACPA100IonisationModel::ReadDiffCSFile(), and G4MicroElecMaterialStructure::ReadMaterialFile().