init: fix Windows build regression — fs::path::c_str() into LogPrint
Phase 4 (cf15b0a39) converted the asmap-file-location debug output from
fprintf(stderr,...) to LogPrint. On Windows, boost::filesystem::path::c_str()
returns const wchar_t*, which tinyformat rejects at compile time
(is_wchar<const wchar_t*> has no tinyformat_wchar_is_not_supported member) —
breaking the mingw cross-build at init.o. The old fprintf accepted wchar_t*
silently (and printed garbage on Windows), so the latent bug only surfaced
once the call became type-checked.
Route all 11 asmap_path.c_str() calls through .string().c_str() so the
argument is a narrow std::string on every platform, matching the existing
correct idiom at pathLockFile.string().c_str() (line ~1662). No behavior
change on POSIX (path::c_str() is already char* there).
Caught by the cross-platform build phase of the 3-box test bring-up.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
22
src/init.cpp
22
src/init.cpp
@@ -1280,33 +1280,33 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (asmap_path.empty()) {
|
if (asmap_path.empty()) {
|
||||||
// Most binaries will have it in PWD
|
// Most binaries will have it in PWD
|
||||||
asmap_path = pwd / DEFAULT_ASMAP_FILENAME;
|
asmap_path = pwd / DEFAULT_ASMAP_FILENAME;
|
||||||
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
if(fs::exists(asmap_path)) {
|
if(fs::exists(asmap_path)) {
|
||||||
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
} else {
|
} else {
|
||||||
// Debian Packages
|
// Debian Packages
|
||||||
asmap_path = fs::path("/usr/share/hush") / DEFAULT_ASMAP_FILENAME;
|
asmap_path = fs::path("/usr/share/hush") / DEFAULT_ASMAP_FILENAME;
|
||||||
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
if(fs::exists(asmap_path)) {
|
if(fs::exists(asmap_path)) {
|
||||||
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
} else {
|
} else {
|
||||||
// Source code
|
// Source code
|
||||||
asmap_path = contrib / DEFAULT_ASMAP_FILENAME;
|
asmap_path = contrib / DEFAULT_ASMAP_FILENAME;
|
||||||
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
if(fs::exists(asmap_path)) {
|
if(fs::exists(asmap_path)) {
|
||||||
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
} else {
|
} else {
|
||||||
// Last Resort: Check the parent directory
|
// Last Resort: Check the parent directory
|
||||||
asmap_path = pwd / ".." / DEFAULT_ASMAP_FILENAME;
|
asmap_path = pwd / ".." / DEFAULT_ASMAP_FILENAME;
|
||||||
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
if(fs::exists(asmap_path)) {
|
if(fs::exists(asmap_path)) {
|
||||||
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
} else {
|
} else {
|
||||||
// Mac SD
|
// Mac SD
|
||||||
asmap_path = fs::path("/Applications/SilentDragon.app/Contents/MacOS/") / DEFAULT_ASMAP_FILENAME;
|
asmap_path = fs::path("/Applications/SilentDragon.app/Contents/MacOS/") / DEFAULT_ASMAP_FILENAME;
|
||||||
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: looking for asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
if(fs::exists(asmap_path)) {
|
if(fs::exists(asmap_path)) {
|
||||||
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: found asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
} else {
|
} else {
|
||||||
// No asmap file found in any known location; abort startup.
|
// No asmap file found in any known location; abort startup.
|
||||||
InitError(strprintf(_("Could not find any asmap file! Please report this bug to DragonX Developers")));
|
InitError(strprintf(_("Could not find any asmap file! Please report this bug to DragonX Developers")));
|
||||||
@@ -1320,7 +1320,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
|||||||
if (!asmap_path.is_absolute()) {
|
if (!asmap_path.is_absolute()) {
|
||||||
asmap_path = GetDataDir() / asmap_path;
|
asmap_path = GetDataDir() / asmap_path;
|
||||||
}
|
}
|
||||||
LogPrint("net", "%s: looking for custom asmap file at %s\n", __func__, asmap_path.c_str() );
|
LogPrint("net", "%s: looking for custom asmap file at %s\n", __func__, asmap_path.string().c_str() );
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: verify asmap_path is not a directory
|
//TODO: verify asmap_path is not a directory
|
||||||
|
|||||||
Reference in New Issue
Block a user