Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write config.yml if it was empty on boot #14153

Merged
merged 3 commits into from Jul 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions rpcs3/Emu/System.cpp
Expand Up @@ -264,6 +264,14 @@ void Emulator::Init()
g_cfg.from_default();
g_cfg.name.clear();

const std::string cfg_path = fs::get_config_dir() + "/config.yml";

// Save new global config if it doesn't exist or is empty
if (fs::stat_t info{}; !fs::stat(cfg_path, info) || info.size == 0)
{
Emulator::SaveSettings(g_cfg.to_string(), {});
}

// Not all renderers are known at compile time, so set a provided default if possible
if (m_default_renderer == video_renderer::vulkan && !m_default_graphics_adapter.empty())
{
Expand Down Expand Up @@ -354,8 +362,6 @@ void Emulator::Init()
// Reload global configuration
if (m_config_mode != cfg_mode::config_override && m_config_mode != cfg_mode::default_config)
{
const auto cfg_path = fs::get_config_dir() + "/config.yml";

if (const fs::file cfg_file{cfg_path, fs::read + fs::create})
{
sys_log.notice("Applying global config: %s", cfg_path);
Expand Down