Remove null terminator from getFileName(Windows)

This commit is contained in:
Marcelo Silva Nascimento Mancini 2022-06-24 16:24:40 -03:00 committed by GitHub
parent e36512f1d4
commit 0f6c36ad39
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();