mirror of
https://github.com/oxen-io/lokinet.git
synced 2024-10-31 09:20:21 +00:00
56 lines
992 B
C++
56 lines
992 B
C++
#pragma once
|
|
|
|
#include <util/fs.hpp>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#ifndef _WIN32
|
|
#include <pwd.h>
|
|
#endif
|
|
|
|
namespace llarp
|
|
{
|
|
constexpr auto our_rc_filename = "self.signed";
|
|
constexpr auto our_identity_filename = "identity.key";
|
|
constexpr auto our_enc_key_filename = "encryption.key";
|
|
constexpr auto our_transport_key_filename = "transport.key";
|
|
|
|
constexpr auto nodedb_dirname = "nodedb";
|
|
|
|
inline fs::path
|
|
GetDefaultDataDir()
|
|
{
|
|
#ifdef _WIN32
|
|
const fs::path homedir = getenv("APPDATA");
|
|
#else
|
|
fs::path homedir;
|
|
|
|
auto pw = getpwuid(getuid());
|
|
if (pw)
|
|
{
|
|
homedir = pw->pw_dir;
|
|
}
|
|
else
|
|
{
|
|
// no home dir specified yea idk
|
|
homedir = "/var/lib/lokinet";
|
|
return homedir;
|
|
}
|
|
#endif
|
|
return homedir / ".lokinet";
|
|
}
|
|
|
|
inline fs::path
|
|
GetDefaultConfigFilename()
|
|
{
|
|
return "lokinet.ini";
|
|
}
|
|
|
|
inline fs::path
|
|
GetDefaultConfigPath()
|
|
{
|
|
return GetDefaultDataDir() / GetDefaultConfigFilename();
|
|
}
|
|
|
|
} // namespace llarp
|