diff options
Diffstat (limited to 'src/util.cpp')
-rw-r--r-- | src/util.cpp | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/util.cpp b/src/util.cpp index 0a14e8bb9e..b76c173f90 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -84,6 +84,8 @@ #include <openssl/rand.h> #include <openssl/conf.h> +// Application startup time (used for uptime calculation) +const int64_t nStartupTime = GetTime(); const char * const BITCOIN_CONF_FILENAME = "bitcoin.conf"; const char * const BITCOIN_PID_FILENAME = "bitcoind.pid"; @@ -420,7 +422,9 @@ void ArgsManager::ParseParameters(int argc, const char* const argv[]) std::vector<std::string> ArgsManager::GetArgs(const std::string& strArg) { LOCK(cs_args); - return mapMultiArgs.at(strArg); + if (IsArgSet(strArg)) + return mapMultiArgs.at(strArg); + return {}; } bool ArgsManager::IsArgSet(const std::string& strArg) @@ -651,21 +655,21 @@ bool RenameOver(fs::path src, fs::path dest) } /** - * Ignores exceptions thrown by Boost's create_directory if the requested directory exists. + * Ignores exceptions thrown by Boost's create_directories if the requested directory exists. * Specifically handles case where path p exists, but it wasn't possible for the user to * write to the parent directory. */ -bool TryCreateDirectory(const fs::path& p) +bool TryCreateDirectories(const fs::path& p) { try { - return fs::create_directory(p); + return fs::create_directories(p); } catch (const fs::filesystem_error&) { if (!fs::exists(p) || !fs::is_directory(p)) throw; } - // create_directory didn't create the directory, it had to have existed already + // create_directories didn't create the directory, it had to have existed already return false; } @@ -889,3 +893,9 @@ std::string CopyrightHolders(const std::string& strPrefix) } return strCopyrightHolders; } + +// Obtain the application startup time (used for uptime calculation) +int64_t GetStartupTime() +{ + return nStartupTime; +} |