Pressing cancel is not an error.

This commit is contained in:
Bartosz Taudul 2022-10-30 00:44:30 +02:00
parent a6a265b548
commit 4abb3b5e90
No known key found for this signature in database
GPG Key ID: B7FE2008B7575DF3

View File

@ -77,12 +77,17 @@ static bool OpenFileImpl( const char* ext, const char* desc, std::function<void(
# else
nfdu8filteritem_t filter = { desc, ext };
nfdu8char_t* fn;
if( NFD_OpenDialogU8( &fn, &filter, 1, nullptr ) == NFD_OKAY )
const auto res = NFD_OpenDialogU8( &fn, &filter, 1, nullptr );
if( res == NFD_OKAY )
{
callback( (const char*)fn );
NFD_FreePathU8( fn );
return true;
}
else
{
return res != NFD_ERROR;
}
# endif
#endif
return false;
@ -93,12 +98,17 @@ static bool SaveFileImpl( const char* ext, const char* desc, std::function<void(
#if !defined TRACY_NO_FILESELECTOR && !defined __EMSCRIPTEN__
nfdu8filteritem_t filter = { desc, ext };
nfdu8char_t* fn;
if( NFD_SaveDialogU8( &fn, &filter, 1, nullptr, nullptr ) == NFD_OKAY )
const auto res = NFD_SaveDialogU8( &fn, &filter, 1, nullptr, nullptr );
if( res == NFD_OKAY )
{
callback( (const char*)fn );
NFD_FreePathU8( fn );
return true;
}
else
{
return res != NFD_ERROR;
}
#endif
return false;
}