Changeset View
Changeset View
Standalone View
Standalone View
src/util/system.h
Show First 20 Lines • Show All 76 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Release all directory locks. This is used for unit testing only, at runtime | * Release all directory locks. This is used for unit testing only, at runtime | ||||
* the global destructor will take care of the locks. | * the global destructor will take care of the locks. | ||||
*/ | */ | ||||
void ReleaseDirectoryLocks(); | void ReleaseDirectoryLocks(); | ||||
bool TryCreateDirectories(const fs::path &p); | bool TryCreateDirectories(const fs::path &p); | ||||
fs::path GetDefaultDataDir(); | fs::path GetDefaultDataDir(); | ||||
// The blocks directory is always net specific. | |||||
const fs::path &GetBlocksDir(); | |||||
const fs::path &GetDataDir(bool fNetSpecific = true); | const fs::path &GetDataDir(bool fNetSpecific = true); | ||||
// Return true if -datadir option points to a valid directory or is not | // Return true if -datadir option points to a valid directory or is not | ||||
// specified. | // specified. | ||||
bool CheckDataDirOption(); | bool CheckDataDirOption(); | ||||
/** Tests only */ | /** Tests only */ | ||||
void ClearDatadirCache(); | void ClearDatadirCache(); | ||||
fs::path GetConfigFile(const std::string &confPath); | fs::path GetConfigFile(const std::string &confPath); | ||||
#ifdef WIN32 | #ifdef WIN32 | ||||
▲ Show 20 Lines • Show All 82 Lines • ▼ Show 20 Lines | protected: | ||||
mutable RecursiveMutex cs_args; | mutable RecursiveMutex cs_args; | ||||
util::Settings m_settings GUARDED_BY(cs_args); | util::Settings m_settings GUARDED_BY(cs_args); | ||||
std::string m_network GUARDED_BY(cs_args); | std::string m_network GUARDED_BY(cs_args); | ||||
std::set<std::string> m_network_only_args GUARDED_BY(cs_args); | std::set<std::string> m_network_only_args GUARDED_BY(cs_args); | ||||
std::map<OptionsCategory, std::map<std::string, Arg>> | std::map<OptionsCategory, std::map<std::string, Arg>> | ||||
m_available_args GUARDED_BY(cs_args); | m_available_args GUARDED_BY(cs_args); | ||||
std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args); | std::list<SectionInfo> m_config_sections GUARDED_BY(cs_args); | ||||
fs::path m_cached_blocks_path GUARDED_BY(cs_args); | |||||
mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args); | mutable fs::path m_cached_datadir_path GUARDED_BY(cs_args); | ||||
mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args); | mutable fs::path m_cached_network_datadir_path GUARDED_BY(cs_args); | ||||
NODISCARD bool ReadConfigStream(std::istream &stream, | NODISCARD bool ReadConfigStream(std::istream &stream, | ||||
const std::string &filepath, | const std::string &filepath, | ||||
std::string &error, | std::string &error, | ||||
bool ignore_invalid_keys = false); | bool ignore_invalid_keys = false); | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | public: | ||||
const std::set<std::string> GetUnsuitableSectionOnlyArgs() const; | const std::set<std::string> GetUnsuitableSectionOnlyArgs() const; | ||||
/** | /** | ||||
* Log warnings for unrecognized section names in the config file. | * Log warnings for unrecognized section names in the config file. | ||||
*/ | */ | ||||
const std::list<SectionInfo> GetUnrecognizedSections() const; | const std::list<SectionInfo> GetUnrecognizedSections() const; | ||||
/** | /** | ||||
* Get blocks directory path | |||||
* | |||||
* @return Blocks path which is network specific | |||||
*/ | |||||
const fs::path &GetBlocksDirPath(); | |||||
/** | |||||
* Get data directory path | * Get data directory path | ||||
* | * | ||||
* @param net_specific Append network identifier to the returned path | * @param net_specific Append network identifier to the returned path | ||||
* @return Absolute path on success, otherwise an empty path when a | * @return Absolute path on success, otherwise an empty path when a | ||||
* non-directory path would be returned | * non-directory path would be returned | ||||
* @post Returned directory path is created unless it is empty | * @post Returned directory path is created unless it is empty | ||||
*/ | */ | ||||
const fs::path &GetDataDirPath(bool net_specific = true) const; | const fs::path &GetDataDirPath(bool net_specific = true) const; | ||||
▲ Show 20 Lines • Show All 268 Lines • Show Last 20 Lines |