From e98ad5bc626fc7372cddb8861a7250825427a141 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Wed, 10 May 2023 19:39:23 -0400 Subject: [PATCH] A few fixes for code to find luprex root --- luprex/cpp/drv/driver.cpp | 3 ++- luprex/cpp/drv/drvutil.cpp | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/luprex/cpp/drv/driver.cpp b/luprex/cpp/drv/driver.cpp index 1b651602..ba3d9a8c 100644 --- a/luprex/cpp/drv/driver.cpp +++ b/luprex/cpp/drv/driver.cpp @@ -42,6 +42,7 @@ std::filesystem::path find_luprex_root(std::filesystem::path exepath) { return pp; } assert(false && "Could not find lua/control.lst"); + return ""; } class Driver { @@ -81,7 +82,7 @@ class Driver { bool marked_for_deletion() const { return state == CHAN_INACTIVE; } }; - std::string luprexroot; + std::filesystem::path luprexroot; EngineWrapper engw; std::vector chans_; std::map listen_sockets_; diff --git a/luprex/cpp/drv/drvutil.cpp b/luprex/cpp/drv/drvutil.cpp index 0f4ffa67..430ad867 100644 --- a/luprex/cpp/drv/drvutil.cpp +++ b/luprex/cpp/drv/drvutil.cpp @@ -95,7 +95,7 @@ static std::vector parse_control_lst(std::string_view ctrl) { static std::string read_file(const std::filesystem::path &fn, std::string &err) { std::ifstream t(fn); if (t.fail()) { - err = std::string("Could not open ") + std::string(fn); + err = std::string("Could not open ") + fn.u8string(); return ""; } t.seekg(0, std::ios::end); @@ -104,7 +104,7 @@ static std::string read_file(const std::filesystem::path &fn, std::string &err) t.seekg(0); t.read(&result[0], size); if ((t.fail()) || (size_t(t.tellg()) != size)) { - err = std::string("Could not read ") + std::string(fn); + err = std::string("Could not read ") + fn.u8string(); return ""; } err = ""; @@ -169,7 +169,7 @@ std::string package_lua_source(const std::filesystem::path &base, std::ostream * for (int i = 0; i < int(names.size()); i++) { std::filesystem::path lfn = base / "lua" / names[i]; if (!sbwrite_file(s, lfn)) { - return std::string("Cannot read source file: ") + std::string(lfn); + return std::string("Cannot read source file: ") + lfn.u8string(); } } return "";