SHiP Geometry
SHiP experiment geometry implementation using GeoModel.
Loading...
Searching...
No Matches
include
SHiPGeometry
ConfigPath.h
Go to the documentation of this file.
1
// SPDX-License-Identifier: LGPL-3.0-or-later
2
// Copyright (C) CERN for the benefit of the SHiP Collaboration
3
4
#pragma once
5
6
#include <filesystem>
7
#include <string>
8
9
namespace
SHiPGeometry
{
10
17
inline
std::string
resolveConfigPath
(
const
std::string& path,
const
std::string& srcFallback,
18
const
std::string& installFallback) {
19
namespace
fs = std::filesystem;
20
if
(!path.empty() && path.front() ==
'/'
)
21
return
path;
// already absolute
22
if
(fs::is_regular_file(path))
23
return
path;
// relative to CWD
24
if
(!srcFallback.empty() && fs::is_regular_file(srcFallback))
25
return
srcFallback;
26
if
(!installFallback.empty() && fs::is_regular_file(installFallback))
27
return
installFallback;
28
return
path;
29
}
30
31
}
// namespace SHiPGeometry
SHiPGeometry
Definition
ConfigPath.h:9
SHiPGeometry::resolveConfigPath
std::string resolveConfigPath(const std::string &path, const std::string &srcFallback, const std::string &installFallback)
Resolve a config-file path against the repo's standard fallback chain.
Definition
ConfigPath.h:17
Generated by
1.9.8