Skip to content

Commit

Permalink
refactor: use fs:: over boost::filesystem::
Browse files Browse the repository at this point in the history
  • Loading branch information
fanquake committed Aug 15, 2018
1 parent 80127f0 commit 4b3b85c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/logging.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ void BCLog::Logger::ShrinkDebugFile()
size_t log_size = 0;
try {
log_size = fs::file_size(m_file_path);
} catch (boost::filesystem::filesystem_error &) {}
} catch (const fs::filesystem_error&) {}

// If debug.log file is more than 10% bigger the RECENT_DEBUG_HISTORY_SIZE
// trim it down by saving only the last RECENT_DEBUG_HISTORY_SIZE bytes
Expand Down
4 changes: 2 additions & 2 deletions src/qt/guiutil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -368,10 +368,10 @@ void openDebugLogfile()

bool openBitcoinConf()
{
boost::filesystem::path pathConfig = GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));
fs::path pathConfig = GetConfigFile(gArgs.GetArg("-conf", BITCOIN_CONF_FILENAME));

/* Create the file */
boost::filesystem::ofstream configFile(pathConfig, std::ios_base::app);
fs::ofstream configFile(pathConfig, std::ios_base::app);

if (!configFile.good())
return false;
Expand Down
6 changes: 3 additions & 3 deletions src/wallet/rpcdump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -706,15 +706,15 @@ UniValue dumpwallet(const JSONRPCRequest& request)

EnsureWalletIsUnlocked(pwallet);

boost::filesystem::path filepath = request.params[0].get_str();
filepath = boost::filesystem::absolute(filepath);
fs::path filepath = request.params[0].get_str();
filepath = fs::absolute(filepath);

/* Prevent arbitrary files from being overwritten. There have been reports
* that users have overwritten wallet files this way:
* https://github.com/bitcoin/bitcoin/issues/9934
* It may also avoid other security issues.
*/
if (boost::filesystem::exists(filepath)) {
if (fs::exists(filepath)) {
throw JSONRPCError(RPC_INVALID_PARAMETER, filepath.string() + " already exists. If you are sure this is what you want, move it out of the way first");
}

Expand Down

0 comments on commit 4b3b85c

Please sign in to comment.