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

defaultPath option for showOpenDialog (file and directory fields) #175

Open
dewiweb opened this issue Jul 22, 2022 · 2 comments
Open

defaultPath option for showOpenDialog (file and directory fields) #175

dewiweb opened this issue Jul 22, 2022 · 2 comments
Labels
enhancement New feature or request

Comments

@dewiweb
Copy link

dewiweb commented Jul 22, 2022

It could be interesting to have the ability to specify in fields "file" and "directory" a defaultPath to open the dialog window in it.
(this option exist on electron side in showOpenDialog but i've got no idea how to ?)

@dewiweb dewiweb added the enhancement New feature or request label Jul 22, 2022
@pvrobays
Copy link
Collaborator

hi @dewiweb
Passing a defaultPath is indeed possible within electron. It's a property in the options parameter that you pass to the showOpenDialog.

IMO you should need a defaultPath, in the case when there is no default preference value set for that preference, and the user hasn't selected one yet.
In all other cases, I guess the defaultPath should be ignored, and the current value (the one set by the either the default preferences or by the user) should be used.

Would this implementation be in line with what you've had in mind?

Some possible caveats to test:

  • OS specific paths
  • Non existing paths
  • File paths should resolve to their parent folder

@dewiweb
Copy link
Author

dewiweb commented Jul 25, 2022

hi @pvrobays ,
Yes it seems to be right. My purpose is to open file dialog in the right folder when the dir preference is set by user.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants