Configure default resource and data directories from CMake
As anbox is expected to installed in two ways (`snap` or `make install`), it should be enough to get `snap` ENV or configure by cmake.
This commit is contained in:
parent
7a8f1efab9
commit
202b556bea
4 changed files with 17 additions and 10 deletions
|
|
@ -90,18 +90,11 @@ anbox::SystemConfiguration::SystemConfiguration() {
|
|||
const auto snap_path = utils::get_env_value("SNAP");
|
||||
if (!snap_path.empty()) {
|
||||
return fs::path(snap_path) / "usr/share/anbox";
|
||||
}
|
||||
|
||||
const std::string exe = utils::process_get_exe_path(::getpid());
|
||||
const std::size_t pos = exe.rfind("/bin/anbox");
|
||||
if (pos != std::string::npos) {
|
||||
const std::string leading_path = exe.substr(0, pos);
|
||||
return fs::path(leading_path) / "share/anbox";
|
||||
} else {
|
||||
return "/usr/local/share/anbox";
|
||||
return default_resource_path;
|
||||
}
|
||||
};
|
||||
|
||||
resource_path = gen_resource_path();
|
||||
data_path = "/var/local/lib/anbox";
|
||||
data_path = default_path_path;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ class SystemConfiguration {
|
|||
boost::filesystem::path data_path;
|
||||
boost::filesystem::path resource_path;
|
||||
|
||||
private:
|
||||
static constexpr const char *default_resource_path{"@ANBOX_RESOURCE_DIR_FULL@"};
|
||||
static constexpr const char *default_path_path{"@ANBOX_STATEDIR_FULL@"};
|
||||
|
||||
};
|
||||
} // namespace anbox
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue