feat(master): say which folder setting is wrong at startup (issue 1113)

Master stops with a message naming client_location, its value and the folder it resolves to when that folder
doesn't exist, instead of failing later on missing client files; a missing dump_folder gets a warning. Check: set
client_location to a folder that doesn't exist: master says so and stops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 09:22:59 -05:00
parent 495d62e559
commit 9ee1431aab

View File

@@ -263,6 +263,14 @@ int main(int argc, char** argv) {
clientPath = BinaryPathFinder::GetBinaryDir() / clientPath;
}
// Say which setting is wrong instead of failing later on missing client files
std::error_code ec;
if (!std::filesystem::is_directory(clientPath, ec)) {
LOG("client_location is \"%s\", which is %s, and that folder doesn't exist. Set client_location in sharedconfig.ini to your client's folder (the one with res/, or the one with client/ and versions/).",
clientPathStr.c_str(), clientPath.string().c_str());
return EXIT_FAILURE;
}
Game::assetManager = new AssetManager(clientPath);
} catch (std::runtime_error& ex) {
LOG("Got an error while setting up assets: %s", ex.what());
@@ -270,6 +278,14 @@ int main(int argc, char** argv) {
return EXIT_FAILURE;
}
// Crash dumps are only written where the folder exists
if (const auto dumpFolder = Game::config->GetValue("dump_folder"); !dumpFolder.empty()) {
std::filesystem::path dumpPath(dumpFolder);
if (dumpPath.is_relative()) dumpPath = BinaryPathFinder::GetBinaryDir() / dumpPath;
std::error_code ec;
if (!std::filesystem::is_directory(dumpPath, ec)) LOG("dump_folder is \"%s\", which is %s, and that folder doesn't exist; crash dumps won't be written until it does.", dumpFolder.c_str(), dumpPath.string().c_str());
}
MigrationRunner::RunMigrations();
// Settings edited on the dashboard (server_config table) are layered over the files from here on
Game::config->SetDatabaseSync(ConfigSync::Sync);