summaryrefslogtreecommitdiff
path: root/c++/environment.hpp
blob: 4915e3a48ad8a97c125ebe2bab0bb94886c9d985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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";
}
}
}