diff options
Diffstat (limited to 'src/util/system.h')
-rw-r--r-- | src/util/system.h | 50 |
1 files changed, 21 insertions, 29 deletions
diff --git a/src/util/system.h b/src/util/system.h index 61f862c93a..c4317c62d0 100644 --- a/src/util/system.h +++ b/src/util/system.h @@ -22,7 +22,6 @@ #include <sync.h> #include <tinyformat.h> #include <util/settings.h> -#include <util/threadnames.h> #include <util/time.h> #include <any> @@ -91,7 +90,6 @@ void ReleaseDirectoryLocks(); bool TryCreateDirectories(const fs::path& p); fs::path GetDefaultDataDir(); -const fs::path &GetDataDir(bool fNetSpecific = true); // Return true if -datadir option points to a valid directory or is not specified. bool CheckDataDirOption(); fs::path GetConfigFile(const std::string& confPath); @@ -120,7 +118,7 @@ UniValue RunCommandParseJSON(const std::string& str_command, const std::string& * the datadir if they are not absolute. * * @param path The path to be conditionally prefixed with datadir. - * @param net_specific Forwarded to GetDataDir(). + * @param net_specific Use network specific datadir variant * @return The normalized path. */ fs::path AbsPathForConfigVal(const fs::path& path, bool net_specific = true); @@ -196,7 +194,7 @@ protected: std::map<OptionsCategory, std::map<std::string, Arg>> m_available_args GUARDED_BY(cs_args); bool m_accept_any_command GUARDED_BY(cs_args){true}; 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_blocks_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); @@ -267,16 +265,23 @@ public: * * @return Blocks path which is network specific */ - const fs::path& GetBlocksDirPath(); + const fs::path& GetBlocksDirPath() const; /** * Get data directory path * - * @param net_specific Append network identifier to the returned path * @return Absolute path on success, otherwise an empty path when a non-directory path would be returned * @post Returned directory path is created unless it is empty */ - const fs::path& GetDataDirPath(bool net_specific = true) const; + const fs::path& GetDataDirBase() const { return GetDataDir(false); } + + /** + * Get data directory path with appended network identifier + * + * @return Absolute path on success, otherwise an empty path when a non-directory path would be returned + * @post Returned directory path is created unless it is empty + */ + const fs::path& GetDataDirNet() const { return GetDataDir(true); } /** * Clear cached directory paths @@ -438,6 +443,15 @@ public: void LogArgs() const; private: + /** + * Get data directory path + * + * @param net_specific Append network identifier to the returned path + * @return Absolute path on success, otherwise an empty path when a non-directory path would be returned + * @post Returned directory path is created unless it is empty + */ + const fs::path& GetDataDir(bool net_specific) const; + // Helper function for LogArgs(). void logArgsPrefix( const std::string& prefix, @@ -478,28 +492,6 @@ std::string HelpMessageOpt(const std::string& option, const std::string& message */ int GetNumCores(); -/** - * .. and a wrapper that just calls func once - */ -template <typename Callable> void TraceThread(const char* name, Callable func) -{ - util::ThreadRename(name); - try - { - LogPrintf("%s thread start\n", name); - func(); - LogPrintf("%s thread exit\n", name); - } - catch (const std::exception& e) { - PrintExceptionContinue(&e, name); - throw; - } - catch (...) { - PrintExceptionContinue(nullptr, name); - throw; - } -} - std::string CopyrightHolders(const std::string& strPrefix); /** |