Skip to content

Commit 8659b1a

Browse files
committed
getGeomFileName treats prefix as filename if such file exists
1 parent eb745f7 commit 8659b1a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

DataFormats/Detectors/Common/src/NameConf.cxx

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,22 @@ bool NameConf::pathIsDirectory(const std::string_view p)
3232
std::string NameConf::getGeomFileName(const std::string_view prefix)
3333
{
3434
// check if the prefix is an existing path
35-
const bool prefixispath = pathIsDirectory(prefix);
36-
if (prefixispath) {
35+
if (pathIsDirectory(prefix)) {
3736
return o2::utils::concat_string(prefix, "/", STANDARDSIMPREFIX, "_", GEOM_FILE_STRING, ".root");
38-
} else {
39-
return o2::utils::concat_string(prefix.empty() ? STANDARDSIMPREFIX : prefix, "_", GEOM_FILE_STRING, ".root");
37+
} else if (pathExists(prefix)) {
38+
return std::string(prefix); // it is a full file
4039
}
40+
return o2::utils::concat_string(prefix.empty() ? STANDARDSIMPREFIX : prefix, "_", GEOM_FILE_STRING, ".root");
4141
}
4242

4343
// Filename to store geometry file
4444
std::string NameConf::getDictionaryFileName(DId det, const std::string_view prefix, const std::string_view ext)
4545
{
4646
// check if the prefix is an existing path
47-
const bool prefixispath = pathIsDirectory(prefix);
48-
if (prefixispath) {
47+
if (pathIsDirectory(prefix)) {
4948
return o2::utils::concat_string(prefix, "/", det.getName(), DICTFILENAME, ext);
50-
} else {
51-
return o2::utils::concat_string(prefix, det.getName(), DICTFILENAME, ext);
49+
} else if (pathExists(prefix)) {
50+
return std::string(prefix); // it is a full file
5251
}
52+
return o2::utils::concat_string(prefix, det.getName(), DICTFILENAME, ext);
5353
}

0 commit comments

Comments
 (0)