diff --git a/library/Core.cpp b/library/Core.cpp index c1c1c850a..97192b000 100644 --- a/library/Core.cpp +++ b/library/Core.cpp @@ -1975,12 +1975,14 @@ void Core::onStateChange(color_ostream &out, state_change_event event) case SC_MAP_UNLOADED: if (world && world->cur_savegame.save_dir.size()) { - std::string evtlogpath = "data/save/" + world->cur_savegame.save_dir + "/events-dfhack.log"; + std::string save_dir = "data/save/" + world->cur_savegame.save_dir; + std::string evtlogpath = save_dir + "/events-dfhack.log"; std::ofstream evtlog; evtlog.open(evtlogpath, std::ios_base::app); // append if (evtlog.fail()) { - out.printerr("Could not append to %s\n", evtlogpath.c_str()); + if (DFHack::Filesystem::isdir(save_dir)) + out.printerr("Could not append to %s\n", evtlogpath.c_str()); } else {