Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions src/ui/rex_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,10 @@ bool ReXApp::OnInitialize() {
bool ReXApp::SetupEnvironment() {
auto exe_dir = rex::filesystem::GetExecutableFolder();

auto default_config_path = exe_dir / (std::string(GetName()) + ".toml");
if (std::filesystem::exists(default_config_path))
rex::cvar::LoadConfig(default_config_path);

std::filesystem::path game_dir;
std::string game_data_cvar = REXCVAR_GET(game_data_root);
if (!game_data_cvar.empty()) {
Expand Down Expand Up @@ -142,7 +146,7 @@ bool ReXApp::SetupEnvironment() {
}

PathConfig path_config{game_dir, user_dir, update_dir,
cache_dir, metadata_dir, exe_dir / (std::string(GetName()) + ".toml")};
cache_dir, metadata_dir, default_config_path};
OnConfigurePaths(path_config);
game_data_root_ = path_config.game_data_root;
user_data_root_ = path_config.user_data_root;
Expand All @@ -152,8 +156,7 @@ bool ReXApp::SetupEnvironment() {
config_path_ = path_config.config_path;
resolved_defaults_ = std::move(path_config);

// Load config FIRST so log cvars have final values
if (std::filesystem::exists(config_path_))
if (config_path_ != default_config_path && std::filesystem::exists(config_path_))
rex::cvar::LoadConfig(config_path_);

// Late-phase logging
Expand Down