Skip to content

Commit

Permalink
Dialog last path fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
timothyschoen committed Nov 16, 2023
1 parent 88a2409 commit 0f89be0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Source/Dialogs/Dialogs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -630,7 +630,8 @@ void Dialogs::showOpenDialog(std::function<void(File&)> callback, bool canSelect
fileChooser->launchAsync(openChooserFlags,
[callback, lastFileId](FileChooser const& fileChooser) {
auto result = fileChooser.getResult();
SettingsFile::getInstance()->setLastBrowserPathForId(lastFileId, result);
auto lastDir = result.isDirectory() ? result : result.getParentDirectory();
SettingsFile::getInstance()->setLastBrowserPathForId(lastFileId, lastDir);
callback(result);
});
}
Expand Down Expand Up @@ -661,7 +662,7 @@ void Dialogs::showSaveDialog(std::function<void(File&)> callback, const String&
auto parentDirectory = result.getParentDirectory();
if(parentDirectory.exists()) {
SettingsFile::getInstance()->setLastBrowserPathForId(lastFileId, parentDirectory);
callback(result);
}
callback(result);
});
}

0 comments on commit 0f89be0

Please sign in to comment.