Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an option for overriding default folder behavior on Windows #151

Closed
dbierek opened this issue Sep 19, 2024 · 5 comments
Closed

Provide an option for overriding default folder behavior on Windows #151

dbierek opened this issue Sep 19, 2024 · 5 comments

Comments

@dbierek
Copy link
Contributor

dbierek commented Sep 19, 2024

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.

// SetFolder() if you always want to use the default folder

Here it mentions that the dialog->SetDefaultFolder call can be changed to dialog->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.

@dbierek
Copy link
Contributor Author

dbierek commented Sep 20, 2024

Screenshot showing the issue in NavKit:
Screenshot 2024-09-20 000142

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.

@btzy
Copy link
Owner

btzy commented Sep 24, 2024

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.

@dbierek
Copy link
Contributor Author

dbierek commented Sep 24, 2024

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.

@btzy
Copy link
Owner

btzy commented Oct 2, 2024

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.

@btzy
Copy link
Owner

btzy commented Oct 3, 2024

Closed by #152.

@btzy btzy closed this as completed Oct 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants