diff options
author | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-03-31 15:22:45 +0200 |
---|---|---|
committer | Philip Kaufmann <phil.kaufmann@t-online.de> | 2012-04-06 15:29:20 +0200 |
commit | 36949554ab1a0466dbee80bbab7a7b2aa74a4cec (patch) | |
tree | 06024ed0313e5795713245fac4dafc70ec782649 | |
parent | 93fb7489a74db621d66bb5fe81acdc49603acd03 (diff) |
updated util.cpp to use make_preferred()
-rw-r--r-- | src/util.cpp | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/util.cpp b/src/util.cpp index d55e7ae10e..70f429b7fc 100644 --- a/src/util.cpp +++ b/src/util.cpp @@ -2,6 +2,7 @@ // Copyright (c) 2009-2012 The Bitcoin developers // Distributed under the MIT/X11 software license, see the accompanying // file license.txt or http://www.opensource.org/licenses/mit-license.php. + #include "headers.h" #include "strlcpy.h" #include <boost/algorithm/string/join.hpp> @@ -858,10 +859,11 @@ string GetDataDir() string GetConfigFile() { namespace fs = boost::filesystem; - fs::path pathConfig(GetArg("-conf", "bitcoin.conf")); - if (!pathConfig.is_complete()) - pathConfig = fs::path(GetDataDir()) / pathConfig; - return pathConfig.string(); + + fs::path pathConfigFile(GetArg("-conf", "bitcoin.conf")); + if (!pathConfigFile.is_complete()) pathConfigFile = fs::path(GetDataDir()) / pathConfigFile; + pathConfigFile.make_preferred(); + return pathConfigFile.string(); } bool ReadConfigFile(map<string, string>& mapSettingsRet, @@ -874,7 +876,9 @@ bool ReadConfigFile(map<string, string>& mapSettingsRet, { if (fs::is_directory(fs::system_complete(mapSettingsRet["-datadir"]))) { - fs::path pathDataDir = fs::system_complete(mapSettingsRet["-datadir"]); + fs::path pathDataDir(fs::system_complete(mapSettingsRet["-datadir"])); + pathDataDir.make_preferred(); + strlcpy(pszSetDataDir, pathDataDir.string().c_str(), sizeof(pszSetDataDir)); } else @@ -908,10 +912,11 @@ bool ReadConfigFile(map<string, string>& mapSettingsRet, string GetPidFile() { namespace fs = boost::filesystem; - fs::path pathConfig(GetArg("-pid", "bitcoind.pid")); - if (!pathConfig.is_complete()) - pathConfig = fs::path(GetDataDir()) / pathConfig; - return pathConfig.string(); + + fs::path pathPidFile(GetArg("-pid", "bitcoind.pid")); + if (!pathPidFile.is_complete()) pathPidFile = fs::path(GetDataDir()) / pathPidFile; + pathPidFile.make_preferred(); + return pathPidFile.string(); } void CreatePidFile(string pidFile, pid_t pid) |