Use XDG instead of /home/heinzi/.cryfs to store integrity data
This commit is contained in:
parent
04bf27402f
commit
b97da2c735
@ -36,6 +36,15 @@ namespace cpputils {
|
||||
return homedir;
|
||||
}
|
||||
|
||||
bf::path HomeDirectory::getXDGDataDir() {
|
||||
const char* xdg_data_dir = std::getenv("XDG_DATA_HOME");
|
||||
if (xdg_data_dir != nullptr) {
|
||||
return xdg_data_dir;
|
||||
}
|
||||
|
||||
return cpputils::system::HomeDirectory::get() / ".local" / "share";
|
||||
}
|
||||
|
||||
FakeHomeDirectoryRAII::FakeHomeDirectoryRAII(const boost::filesystem::path &fakeHomeDirectory)
|
||||
:_oldHomeDirectory(HomeDirectory::singleton()._home_directory) {
|
||||
HomeDirectory::singleton()._home_directory = fakeHomeDirectory;
|
||||
|
@ -15,6 +15,8 @@ namespace cpputils {
|
||||
public:
|
||||
static const boost::filesystem::path &get();
|
||||
|
||||
static boost::filesystem::path getXDGDataDir();
|
||||
|
||||
private:
|
||||
boost::filesystem::path _home_directory;
|
||||
|
||||
|
@ -22,7 +22,7 @@ namespace cryfs {
|
||||
}
|
||||
|
||||
const bf::path& Environment::defaultLocalStateDir() {
|
||||
static const bf::path value = cpputils::system::HomeDirectory::get() / ".cryfs";
|
||||
static const bf::path value = cpputils::system::HomeDirectory::getXDGDataDir() / "cryfs";
|
||||
return value;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user