From 3e605aa5fb4beff191122882d095a83cca3fa232 Mon Sep 17 00:00:00 2001 From: Alex Grant Benedict Date: Sun, 28 Nov 2021 12:00:56 -0700 Subject: [PATCH] Minor fix ups for TCHAR == char on XP. Add in stub function for detectpresence on windows. --- gameheaders/stratagus-gameutils.h | 12 ++++++------ gameheaders/stratagus-tinyfiledialogs.h | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/gameheaders/stratagus-gameutils.h b/gameheaders/stratagus-gameutils.h index 21f563f10..042564b19 100644 --- a/gameheaders/stratagus-gameutils.h +++ b/gameheaders/stratagus-gameutils.h @@ -181,16 +181,16 @@ wchar_t *GetExtractionLogPath(const wchar_t *game_name, const wchar_t *data_path wchar_t logname[MAX_PATH]; wcscpy(logname, game_name); wcscat(logname, L"-extraction.log"); - if (PathCombine(marker, data_path, L"portable-install")) { - if (PathFileExists(marker)) { - PathCombine(marker, data_path, logname); + if (PathCombineW(marker, data_path, L"portable-install")) { + if (PathFileExistsW(marker)) { + PathCombineW(marker, data_path, logname); return marker; } } - SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, marker); - PathAppend(marker, L"Stratagus"); + SHGetFolderPathW(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL, 0, marker); + PathAppendW(marker, L"Stratagus"); mkdir_p(marker); - PathAppend(marker, logname); + PathAppendW(marker, logname); return marker; } #endif diff --git a/gameheaders/stratagus-tinyfiledialogs.h b/gameheaders/stratagus-tinyfiledialogs.h index ee39d08de..73e225277 100644 --- a/gameheaders/stratagus-tinyfiledialogs.h +++ b/gameheaders/stratagus-tinyfiledialogs.h @@ -178,6 +178,11 @@ char *tinyfd_colorChooser( /************ WINDOWS ONLY SECTION ************************/ #ifdef _WIN32 +static int detectPresence(char const *const aExecutable) +{ + return 0; +} + /* windows only - utf-16 version */ int tinyfd_notifyPopupW( wchar_t const *aTitle, /* NULL or L"" */ @@ -2922,12 +2927,12 @@ char *tinyfd_inputBox( if (tinyfd_winUtf8) { writeUtf8(aMessage); } else { printf("%s", aMessage); } printf("\n"); - } + } printf("(ctrl-Z + enter to cancel): "); if (! aDefaultInput) { (void) GetConsoleMode(hStdin, &mode); (void) SetConsoleMode(hStdin, mode & (~ENABLE_ECHO_INPUT)); - } + } if (tinyfd_winUtf8) { lConsoleHandle = GetStdHandle(STD_INPUT_HANDLE); (void) ReadConsoleW(lConsoleHandle, lBuffW, MAX_PATH_OR_CMD, &lNum, NULL); @@ -5559,7 +5564,7 @@ char *tinyfd_saveFileDialog( strcat(lDialogString, "initialfile='") ; strcat(lDialogString, lString) ; strcat(lDialogString, "',") ; - } + } } if ((aNumOfFilterPatterns > 1) || ((aNumOfFilterPatterns == 1) /* test because poor osx behaviour */ @@ -5574,7 +5579,7 @@ char *tinyfd_saveFileDialog( strcat(lDialogString, "'") ; strcat(lDialogString, aFilterPatterns[i]) ; strcat(lDialogString, "',") ; - } + } strcat(lDialogString, ")),") ; strcat(lDialogString, "('All files','*'))") ; } @@ -5972,13 +5977,13 @@ char *tinyfd_openFileDialog( if (strlen(lString)) { strcat(lDialogString, "initialdir='") ; strcat(lDialogString, lString) ; - strcat(lDialogString, "',") ; - } + strcat(lDialogString, "',") ; + } getLastName(lString, aDefaultPathAndFile) ; if (strlen(lString)) { strcat(lDialogString, "initialfile='") ; strcat(lDialogString, lString) ; - strcat(lDialogString, "',") ; + strcat(lDialogString, "',") ; } } if ((aNumOfFilterPatterns > 1) @@ -5994,7 +5999,7 @@ char *tinyfd_openFileDialog( strcat(lDialogString, "'") ; strcat(lDialogString, aFilterPatterns[i]) ; strcat(lDialogString, "',") ; - } + } strcat(lDialogString, ")),") ; strcat(lDialogString, "('All files','*'))") ; }