mirror of
https://github.com/geode-sdk/geode.git
synced 2024-11-14 19:15:05 -05:00
fix dialog opening stuff
This commit is contained in:
parent
56f878ccb3
commit
62b6241e37
2 changed files with 4 additions and 1 deletions
|
@ -409,12 +409,14 @@ void FileSettingNodeV3::onPickFile(CCObject*) {
|
|||
)->show();
|
||||
}
|
||||
});
|
||||
std::error_code ec;
|
||||
m_pickListener.setFilter(file::pick(
|
||||
this->getSetting()->isFolder() ?
|
||||
file::PickMode::OpenFolder :
|
||||
(this->getSetting()->useSaveDialog() ? file::PickMode::SaveFile : file::PickMode::OpenFile),
|
||||
{
|
||||
dirs::getGameDir(),
|
||||
// Prefer opening the current path directly if possible
|
||||
m_path.empty() || !std::filesystem::exists(m_path.parent_path(), ec) ? dirs::getGameDir() : m_path,
|
||||
this->getSetting()->getFilters().value_or(std::vector<file::FilePickOptions::Filter>())
|
||||
}
|
||||
));
|
||||
|
|
|
@ -182,6 +182,7 @@ Result<> nfdPick(
|
|||
}
|
||||
if (options.defaultPath && options.defaultPath.value().wstring().size()) {
|
||||
std::filesystem::path path = options.defaultPath.value();
|
||||
path.make_preferred();
|
||||
if (mode == NFDMode::OpenFile || mode == NFDMode::SaveFile) {
|
||||
if (!std::filesystem::exists(path) || !std::filesystem::is_directory(path)) {
|
||||
if (path.has_filename()) {
|
||||
|
|
Loading…
Reference in a new issue