Closed dbierek closed 2 months ago
Screenshot showing the issue in NavKit:
In this case, the Hitman 3
button opens a file dialog with a default path of C:\Program Files (x86)\Steam\steamapps\common\HITMAN 3
, but the most recent folder opened was D:\workspace\NavKit\output
, so it is defaulting to that folder instead of the HITMAN 3
folder, making it so the user must manually select the desired folder.
Yes, I agree that a way to use IFileDialog::SetFolder
will be useful.
Note that the "correct" way to have dialogs for different purposes on Windows is to call IFileDialog::SetClientGuid
though. This will persist separate last used folders for each GUID. I'm not sure if there's a way to do something similar on macOS and GTK though.
Note that the "correct" way to have dialogs for different purposes on Windows is to call
IFileDialog::SetClientGuid
though. This will persist separate last used folders for each GUID.
Interesting, I wasn't aware of this option. Perhaps that can be exposed through the library as a way for at least each Windows dialog to maintain its own recent folder.
I kinda think that if we are to expose setting the GUID for Windows only, then NFDe users will likely end up writing extra macOS- and Linux-specific code to do it manually on those platforms, since if they really need per-GUID recent folders on Windows, then they probably can't live with the default behaviour on macOS and Linux either. So I think NFDe will likely have to come with a manual implementation on those platforms.
Closed by #152.
Issue description:
When a program has multiple file / folder dialogs that are for different purposes (for instance different file types), defaulting to the most recent folder on Windows forces the user to have to manually navigate to different folders, even when the program is manually setting different default paths for each dialog type.
https://github.com/btzy/nativefiledialog-extended/blob/79ebd337d791f260e26e5b3decdff145954c8c5c/src/nfd_win.cpp#L255
Here it mentions that the
dialog->SetDefaultFolder
call can be changed todialog->SetFolder
to override this behavior, however this change must be manually made to the underlying library code. When pulling in nativefiledialog-extended via vcpkg, this method is unavailable, and the code must be manually imported and modified.Suggested Change:
I think it would be beneficial to allow an option to allow overriding this default behavior, either in the args structs or in functions as an optional parameter. Maybe something like
bool overrideRecentPathWithDefault
.