diff options
author | Gavin Andresen <gavinandresen@gmail.com> | 2012-04-09 10:41:59 -0400 |
---|---|---|
committer | Gavin Andresen <gavinandresen@gmail.com> | 2012-04-09 10:41:59 -0400 |
commit | 1044391135b9d2e309c1e960afc72afa2a7e04f5 (patch) | |
tree | bdf675c68fd065cee911c04e83e13b1ede480117 /src/util.cpp | |
parent | 138d08c5315c45b3dd08184c4eeb77ee3e47ef0a (diff) | |
parent | 42c63d3ad2e3d3d64d23f01c0286edbeacff82ae (diff) |
Merge branch 'filesystem' of https://github.com/Diapolo/bitcoin
Diffstat (limited to 'src/util.cpp')
-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) |