Windows: Open folder chooser only if current folder has no ALD files

This commit is contained in:
kichikuou
2021-10-23 09:18:13 +09:00
parent 40a4d8b2f6
commit 066295df2f
3 changed files with 11 additions and 1 deletions
+9
View File
@@ -40,6 +40,15 @@ static int CALLBACK select_game_callback(HWND hwnd, UINT uMsg, LPARAM lParam, LP
return 0;
}
boolean current_folder_has_ald(void) {
WIN32_FIND_DATA find_data;
HANDLE hFind = FindFirstFile("*.ALD", &find_data);
if (hFind == INVALID_HANDLE_VALUE)
return FALSE;
FindClose(hFind);
return TRUE;
}
boolean select_game_folder(void) {
char title[256];
LoadString(GetModuleHandle(NULL), IDS_CHOOSE_GAME_FOLDER, title, sizeof(title));
+1
View File
@@ -24,6 +24,7 @@
struct inputstring_param;
struct inputnum_param;
boolean current_folder_has_ald(void);
boolean select_game_folder(void);
boolean input_string(struct inputstring_param *p);
boolean input_number(struct inputnum_param *p);
+1 -1
View File
@@ -486,7 +486,7 @@ int main(int argc, char **argv) {
chdir(argv[2]);
#endif
#ifdef _WIN32
if (argc == 1) {
if (argc == 1 && !current_folder_has_ald()) {
if (!select_game_folder())
return 0;
}