From 11766ec61bf03c584b84ecdf444b90454485c29c Mon Sep 17 00:00:00 2001 From: DanS Date: Thu, 27 Aug 2026 17:04:36 -0500 Subject: [PATCH] =?UTF-8?q?init:=20fix=20Windows=20build=20regression=20?= =?UTF-8?q?=E2=80=94=20fs::path::c=5Fstr()=20into=20LogPrint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 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) --- src/init.cpp | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/init.cpp b/src/init.cpp index d0c947bef..242309d99 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -1280,33 +1280,33 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) if (asmap_path.empty()) { // Most binaries will have it in PWD 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)) { - 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 { // Debian Packages 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)) { - 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 { // Source code 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)) { - 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 { // Last Resort: Check the parent directory 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)) { - 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 { // Mac SD 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)) { - 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 { // 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"))); @@ -1320,7 +1320,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) if (!asmap_path.is_absolute()) { 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