Skip to content

Commit

Permalink
Fixed file dialogs callback being used when user hits "Cancel" on Mac OS
Browse files Browse the repository at this point in the history
  • Loading branch information
Cruor committed Sep 3, 2022
1 parent 8813866 commit 464a1c6
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/utils/filesystem.lua
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ function filesystem.openDialog(path, filter, callback)
return threadHandler.createStartWithCallback(code, callback, path, filter)

else
callback(nfd.open(filter, path))
local result = nfd.open(filter, path)

if result then
callback(result)
end

return false, false
end
Expand Down Expand Up @@ -381,7 +385,11 @@ function filesystem.openFolderDialog(path, callback)
return threadHandler.createStartWithCallback(code, callback, path)

else
callback(nfd.openFolder(path))
local result = nfd.openFolder(path)

if result then
callback(result)
end

return false, false
end
Expand Down

0 comments on commit 464a1c6

Please sign in to comment.