mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-04 06:12:07 +01:00
Simplify fs::path by dropping filename() and make_preferred() overloads
These overloads were needed to allow passing `fs::path` objects directly to libstdc++'s `fstream` constructors, but after the previous commit, there is no longer any remaining code that does pass `fs::path` objects to `fstream` constructors. Writing new code which does this is also discouraged because the standard has been updated in https://wg21.link/lwg3430 to disallow it. Dropping these also means its no longer possible to pass `fs::path` arguments directly to `fstream::open` in libstdc++, which is somewhat unfortunate but not a big loss because it is already not possible to pass them to the constructor. So this commit updates `fstream::open` calls. Additionally, this change required updates to src/bitcoin.cpp since it was relying on the overloaded filename() method.
This commit is contained in:
@@ -114,7 +114,7 @@ GenerateAuthCookieResult GenerateAuthCookie(const std::optional<fs::perms>& cook
|
||||
if (filepath_tmp.empty()) {
|
||||
return GenerateAuthCookieResult::DISABLED; // -norpccookiefile
|
||||
}
|
||||
file.open(filepath_tmp);
|
||||
file.open(filepath_tmp.std_path());
|
||||
if (!file.is_open()) {
|
||||
LogWarning("Unable to open cookie authentication file %s for writing", fs::PathToString(filepath_tmp));
|
||||
return GenerateAuthCookieResult::ERR;
|
||||
@@ -153,7 +153,7 @@ bool GetAuthCookie(std::string *cookie_out)
|
||||
if (filepath.empty()) {
|
||||
return true; // -norpccookiefile
|
||||
}
|
||||
file.open(filepath);
|
||||
file.open(filepath.std_path());
|
||||
if (!file.is_open())
|
||||
return false;
|
||||
std::getline(file, cookie);
|
||||
|
||||
Reference in New Issue
Block a user