A few fixes for code to find luprex root

This commit is contained in:
2023-05-10 19:39:23 -04:00
parent 64b4fc465d
commit e98ad5bc62
2 changed files with 5 additions and 4 deletions

View File

@@ -42,6 +42,7 @@ std::filesystem::path find_luprex_root(std::filesystem::path exepath) {
return pp; return pp;
} }
assert(false && "Could not find lua/control.lst"); assert(false && "Could not find lua/control.lst");
return "";
} }
class Driver { class Driver {
@@ -81,7 +82,7 @@ class Driver {
bool marked_for_deletion() const { return state == CHAN_INACTIVE; } bool marked_for_deletion() const { return state == CHAN_INACTIVE; }
}; };
std::string luprexroot; std::filesystem::path luprexroot;
EngineWrapper engw; EngineWrapper engw;
std::vector<ChanInfo> chans_; std::vector<ChanInfo> chans_;
std::map<int, SOCKET> listen_sockets_; std::map<int, SOCKET> listen_sockets_;

View File

@@ -95,7 +95,7 @@ static std::vector<std::string> parse_control_lst(std::string_view ctrl) {
static std::string read_file(const std::filesystem::path &fn, std::string &err) { static std::string read_file(const std::filesystem::path &fn, std::string &err) {
std::ifstream t(fn); std::ifstream t(fn);
if (t.fail()) { if (t.fail()) {
err = std::string("Could not open ") + std::string(fn); err = std::string("Could not open ") + fn.u8string();
return ""; return "";
} }
t.seekg(0, std::ios::end); 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.seekg(0);
t.read(&result[0], size); t.read(&result[0], size);
if ((t.fail()) || (size_t(t.tellg()) != 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 ""; return "";
} }
err = ""; 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++) { for (int i = 0; i < int(names.size()); i++) {
std::filesystem::path lfn = base / "lua" / names[i]; std::filesystem::path lfn = base / "lua" / names[i];
if (!sbwrite_file(s, lfn)) { 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 ""; return "";