Skip to content

Commit

Permalink
main: Defer pref path check
Browse files Browse the repository at this point in the history
  • Loading branch information
Macdu committed Oct 12, 2023
1 parent 6697648 commit 3868a98
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions vita3k/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,6 @@ int main(int argc, char *argv[]) {
root_paths.set_base_path(string_utils::utf_to_wide(SDL_GetBasePath()));
root_paths.set_pref_path(string_utils::utf_to_wide(SDL_GetPrefPath(org_name, app_name)));

// Create default preference path for safety
if (!fs::exists(root_paths.get_pref_path()))
fs::create_directories(root_paths.get_pref_path());

if (logging::init(root_paths, true) != Success)
return InitConfigFailed;

Expand Down Expand Up @@ -128,8 +124,14 @@ int main(int argc, char *argv[]) {

Config cfg{};
EmuEnvState emuenv;
if (const auto err = config::init_config(cfg, argc, argv, root_paths) != Success) {
if (err == QuitRequested) {
const auto config_err = config::init_config(cfg, argc, argv, root_paths);

// Create preference path for safety
if (!fs::exists(cfg.pref_path))
fs::create_directories(cfg.pref_path);

if (config_err != Success) {
if (config_err == QuitRequested) {
if (cfg.recompile_shader_path.has_value()) {
LOG_INFO("Recompiling {}", *cfg.recompile_shader_path);
shader::convert_gxp_to_glsl_from_filepath(*cfg.recompile_shader_path);
Expand All @@ -143,7 +145,7 @@ int main(int argc, char *argv[]) {
}
if (cfg.pup_path.has_value()) {
LOG_INFO("Installing firmware file {}", *cfg.pup_path);
install_pup(emuenv.pref_path, *cfg.pup_path, [](uint32_t progress) {
install_pup(string_utils::utf_to_wide(cfg.pref_path), *cfg.pup_path, [](uint32_t progress) {
LOG_INFO("Firmware installation progress: {}%", progress);
});
}
Expand Down

0 comments on commit 3868a98

Please sign in to comment.