IAP GITLAB

Skip to content
Snippets Groups Projects
Commit 4dce9b9c authored by Maximilian Reininghaus's avatar Maximilian Reininghaus :vulcan: Committed by Maximilian Reininghaus
Browse files

central access to CORSIKA_DATA path

parent f98c436d
No related branches found
No related tags found
2 merge requests!234WIP: Initial example of python as script language from C++,!205UrQMD improvements
...@@ -20,10 +20,12 @@ endif () ...@@ -20,10 +20,12 @@ endif ()
set ( set (
UTILITIES_SOURCES UTILITIES_SOURCES
COMBoost.cc COMBoost.cc
CorsikaData.cc
${CORSIKA_FENV}) ${CORSIKA_FENV})
set ( set (
UTILITIES_HEADERS UTILITIES_HEADERS
CorsikaData.h
COMBoost.h COMBoost.h
Bit.h Bit.h
Singleton.h Singleton.h
......
#include <corsika/utl/CorsikaData.h>
#include <cstdlib>
#include <stdexcept>
#include <string>
std::filesystem::path corsika::utl::CorsikaData(std::filesystem::path const& key) {
if (auto const* p = std::getenv("CORSIKA_DATA"); p != nullptr) {
auto const path = std::filesystem::path(p) / key;
return path;
} else {
throw std::runtime_error("CORSIKA_DATA not set");
}
}
/*
* (c) Copyright 2020 CORSIKA Project, corsika-project@lists.kit.edu
*
* See file AUTHORS for a list of contributors.
*
* This software is distributed under the terms of the GNU General Public
* Licence version 3 (GPL Version 3). See file LICENSE for a full version of
* the license.
*/
#include <filesystem>
#include <string>
namespace corsika::utl {
/**
* returns the full path of the file \p filename within the CORSIKA_DATA directory
*/
std::filesystem::path CorsikaData(std::filesystem::path const& filename);
} // namespace corsika::utl
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment