Use last selected directory when using default file name in dialog.showSaveDialog()
Prior to this change, attempting to use `dialog.showSaveDialog({ defaultPath: 'foo.png' })` would open the save dialog to the current directory with the default file name set to `foo.png`. We now use the last selected directory instead of the current directory. Absolute paths are not affected by this change.
This commit is contained in:
parent
fea165bef8
commit
19555bbab2
4 changed files with 16 additions and 6 deletions
|
@ -65,8 +65,11 @@ void SetupDialog(NSSavePanel* dialog,
|
|||
if (base::DirectoryExists(settings.default_path)) {
|
||||
default_dir = base::SysUTF8ToNSString(settings.default_path.value());
|
||||
} else {
|
||||
default_dir =
|
||||
base::SysUTF8ToNSString(settings.default_path.DirName().value());
|
||||
if (settings.default_path.IsAbsolute()) {
|
||||
default_dir =
|
||||
base::SysUTF8ToNSString(settings.default_path.DirName().value());
|
||||
}
|
||||
|
||||
default_filename =
|
||||
base::SysUTF8ToNSString(settings.default_path.BaseName().value());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue