Repository navigation
feat: use Downloads folder as default path for file dialogs - #49868
Conversation
8fdaeac to
47e8894
Compare
jkleinsc
left a comment
There was a problem hiding this comment.
We should document this as a breaking change since it changes current behavior. Its possible some applications are currently depending on this defaulting to the current working directory.
47e8894 to
5c4bc26
Compare
| * `options` Object | ||
| * `title` string (optional) | ||
| * `defaultPath` string (optional) | ||
| * `defaultPath` string (optional) - Absolute directory path, absolute file |
There was a problem hiding this comment.
If a user has previously selected a different folder using a file dialog, that will still override the defaultPath value, correct? If so we should mention that behavior.
There was a problem hiding this comment.
I think the updated example for preserving old behavior helps clarify this for me.
A less confusing property name might be initialPath, but I'm OK saving that for a follow-up, unless we want to combine all the breaking changes into one release.
| * `dialog.showSaveDialog` | ||
| * `dialog.showSaveDialogSync` | ||
|
|
||
| Previously, these methods used the last-opened directory or an OS-determined default. To preserve the old behavior, explicitly pass `defaultPath` when calling these methods. |
There was a problem hiding this comment.
This feels a little confusing as-worded. IIUC the last-opened directory behavior isn't changing. It's just the OS-determined default that is now changing to Downloads, with a Home dir fallback.
How easy will it be for app developers to replicate the "OS-determined default" in order to pass it to defaultPath. If they just want the current working directory that's pretty easy, but is that the current behavior across OSes?
Co-authored-by: Sourav Bera <[email protected]>
5c4bc26 to
c203d4c
Compare
| if (!result.canceled && result.filePaths.length > 0) { | ||
| lastUsedPath = path.dirname(result.filePaths[0]) | ||
| } | ||
| ``` |
| * `options` Object | ||
| * `title` string (optional) | ||
| * `defaultPath` string (optional) | ||
| * `defaultPath` string (optional) - Absolute directory path, absolute file |
There was a problem hiding this comment.
I think the updated example for preserving old behavior helps clarify this for me.
A less confusing property name might be initialPath, but I'm OK saving that for a follow-up, unless we want to combine all the breaking changes into one release.
|
Release Notes Persisted
|
Description of Change
Closes #49237.
Supersedes #49538.
Fixes file dialogs opening in the current working directory when
defaultPathis not provided. Dialogs now default to the user's Downloads folder (or Home directory if Downloads doesn't exist).Checklist
npm testpassesRelease Notes
Notes: File downloads will open by default in the user's Downloads folder (or Home directory if Downloads doesn't exist).