Skip to content

Commit

Permalink
Previous change would miss dynamic exes. I've fixed that here, tidied…
Browse files Browse the repository at this point in the history
… the code a bit and fixed the comments.
  • Loading branch information
maplesond committed May 3, 2018
1 parent ca063e6 commit c4020a9
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions lib/include/kat/kat_fs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,21 +132,17 @@ class KatFS {
altroot = altroot.parent_path();
}
this->scriptsDir = altroot / kat_scripts;
} else if (exe_dir.leaf().string() == "src") {
// Presumably if we are here then we are running the kat executable from the source directory
if (exists(exe_dir.parent_path() / "kat.cc")) {
this->scriptsDir = exe_dir.parent_path().parent_path() / "scripts";
}
else if (exists(exe_dir / "kat.cc")) {
this->scriptsDir = exe_dir.parent_path() / "scripts";
}
} else if (exe_dir.leaf().string() == "tests") {
// Presumably if we are here then we are running the kat executable from the source directory
if (exists(exe_dir / "check_main.cc")) {
this->scriptsDir = exe_dir.parent_path() / "scripts";
}
} else if (exe_dir.leaf().string() == ".libs" && exists(exe_dir.parent_path() / "kat.cc")) {
// If we are here then we are running the kat executable from the source directory but linked dynamically
this->scriptsDir = exe_dir.parent_path().parent_path() / "scripts";
} else if (exe_dir.leaf().string() == "src" && exists(exe_dir / "kat.cc")) {
// If we are here then we are running the kat executable from the source directory but linked statically
this->scriptsDir = exe_dir.parent_path() / "scripts";
} else if (exe_dir.leaf().string() == "tests" && exists(exe_dir / "check_main.cc")) {
// Presumably if we are here then we are running unit tests
this->scriptsDir = exe_dir.parent_path() / "scripts";
} else {
// So if we got here then probably we are running unit tests.
// So if we got here then I'm not sure what config we are in. So just use whatever scripts directory was provided.
this->scriptsDir = kat_scripts;
}

Expand Down

0 comments on commit c4020a9

Please sign in to comment.