@@ -35,9 +35,8 @@ static void managePathListCallback(std::string selection)
3535 }
3636}
3737
38- static bool manageSinglePath (const char * label, config::Option<std::string, false >& pathOption, const char * helpText)
38+ static void manageSinglePath (const char * label, config::Option<std::string, false >& pathOption, const char * helpText)
3939{
40- const std::string popupName = std::string (" Select " ) + label;
4140 ImVec2 size;
4241 size.x = 0 .0f ;
4342 size.y = ImGui::GetTextLineHeightWithSpacing () + ImGui::GetStyle ().FramePadding .y * 2 .f ;
@@ -65,10 +64,16 @@ static bool manageSinglePath(const char* label, config::Option<std::string, fals
6564 ImGui::SameLine ();
6665 ShowHelpMarker (helpText);
6766
67+ static std::string *pCurrentPath;
68+ pCurrentPath = &pathOption.get ();
69+ const std::string popupName = std::string (" Select " ) + label;
70+ select_file_popup (popupName.c_str (), [](bool cancelled, std::string selection) {
71+ if (!cancelled)
72+ *pCurrentPath = selection;
73+ return true ;
74+ });
6875 if (openPopup)
6976 ImGui::OpenPopup (popupName.c_str ());
70-
71- return openPopup;
7277}
7378
7479static void managePathList (const char * label, std::vector<std::string>& paths, const char * helpText)
@@ -419,16 +424,16 @@ void gui_settings_general()
419424 ImGui::Spacing ();
420425
421426#if !defined(__ANDROID__)
422- managePathList (" VMU Folders " , config::VMUPath. get () ,
423- " Folders where VMU (.bin) saves are stored. First path is used for new saves; all are searched when loading " );
427+ manageSinglePath (" VMU Folder " , config::VMUPath,
428+ " Folder where VMU (.bin) saves are stored" );
424429 ImGui::Spacing ();
425430
426431 managePathList (" Savestate Folders" , config::SavestatePath.get (),
427432 " Folders for save states. First path is used for new states; all are searched when loading" );
428433 ImGui::Spacing ();
429434
430- managePathList (" Game Save Folders " , config::SavePath. get () ,
431- " Folders for game save data (e.g. arcade NVRAM). First path is used for new saves; all are searched when loading " );
435+ manageSinglePath (" Game Save Folder " , config::SavePath,
436+ " Folder for game save data (e.g. arcade NVRAM)" );
432437 ImGui::Spacing ();
433438#endif
434439
@@ -439,22 +444,10 @@ void gui_settings_general()
439444#if !defined(__ANDROID__)
440445 manageSinglePath (" Texture Dump Folder" , config::TextureDumpPath,
441446 " Folder where texture dumps are saved. Game-specific subfolders will be created automatically" );
442- // Handle texture dump folder popup
443- select_file_popup (" Select Texture Dump Folder" , [](bool cancelled, std::string selection) {
444- if (!cancelled)
445- config::TextureDumpPath = selection;
446- return true ;
447- });
448447 ImGui::Spacing ();
449448
450449 manageSinglePath (" Box Art Folder" , config::BoxartPath,
451450 " Folder containing box art images (png/jpg). If empty, Flycast will use the default Home Folder/boxart for downloads and generated art" );
452- // Handle box art folder popup
453- select_file_popup (" Select Box Art Folder" , [](bool cancelled, std::string selection) {
454- if (!cancelled)
455- config::BoxartPath = selection;
456- return true ;
457- });
458451 ImGui::Spacing ();
459452
460453 managePathList (" Controller Mapping Folders" , config::MappingsPath.get (),
0 commit comments