diff options
Diffstat (limited to 'lib/c++/environment.hpp')
| -rw-r--r-- | lib/c++/environment.hpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/lib/c++/environment.hpp b/lib/c++/environment.hpp new file mode 100644 index 0000000..4915e3a --- /dev/null +++ b/lib/c++/environment.hpp @@ -0,0 +1,24 @@ +#pragma once + +#include <forstio/error.hpp> +#include <filesystem> +#include <cstdlib> + +namespace kel { +namespace lbm { + +/** + * Returns the default output directory. + * Located outside the project dir because dispatching build jobs with output data in the git directory + * also copies simulated data which takes a long time. + */ +saw::error_or<std::filesystem::path> output_directory(){ + const char* home_dir = std::getenv("HOME"); + if(not home_dir){ + return saw::make_error<saw::err::not_found>("Couldn't find home dir"); + } + + return std::filesystem::path{home_dir} / ".lbm"; +} +} +} |
