Merge pull request #333 from MrcSnm/patch-1

Remove null terminator from getFileName(Windows)
This commit is contained in:
Adam D. Ruppe 2022-06-24 15:26:17 -04:00 committed by GitHub
commit f6306d331f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -13546,8 +13546,12 @@ void getFileName(
}
ofn.lpstrFile = file.ptr;
ofn.nMaxFile = file.length;
if(openOrSave ? GetOpenFileName(&ofn) : GetSaveFileName(&ofn)) {
onOK(makeUtf8StringFromWindowsString(ofn.lpstrFile));
if(openOrSave ? GetOpenFileName(&ofn) : GetSaveFileName(&ofn))
{
string okString = makeUtf8StringFromWindowsString(ofn.lpstrFile);
if(okString[$-1] == '\0')
okString = okString[0..$-1];
onOK(okString);
} else {
if(onCancel)
onCancel();