diff options
author | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 20:56:05 +0000 |
---|---|---|
committer | avi@chromium.org <avi@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 20:56:05 +0000 |
commit | 8f072c6b70969f123d6c57063b00ca8ff7011037 (patch) | |
tree | 2f3643ab7a5e7b709a4178a3ba873b2b31651542 /chrome/browser/cocoa | |
parent | da0af4ddcd641a60e467f708a83d195ddc9fc9e0 (diff) | |
download | chromium_src-8f072c6b70969f123d6c57063b00ca8ff7011037.zip chromium_src-8f072c6b70969f123d6c57063b00ca8ff7011037.tar.gz chromium_src-8f072c6b70969f123d6c57063b00ca8ff7011037.tar.bz2 |
Mac: Fix file selector moving up one dir each time you use it.
If default_path is a directory, start the file open dialog in that dir, rather than in the parent with that dir selected.
BUG=49081
TEST=see #2 on bug
Review URL: http://codereview.chromium.org/4106003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64146 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa')
-rw-r--r-- | chrome/browser/cocoa/shell_dialogs_mac.mm | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/chrome/browser/cocoa/shell_dialogs_mac.mm b/chrome/browser/cocoa/shell_dialogs_mac.mm index bb1ad05..46f5ea2 100644 --- a/chrome/browser/cocoa/shell_dialogs_mac.mm +++ b/chrome/browser/cocoa/shell_dialogs_mac.mm @@ -13,6 +13,7 @@ #include "app/l10n_util_mac.h" #import "base/cocoa_protocols_mac.h" +#include "base/file_util.h" #include "base/logging.h" #include "base/mac_util.h" #include "base/mac/scoped_cftyperef.h" @@ -165,8 +166,13 @@ void SelectFileDialogImpl::SelectFile( NSString* default_dir = nil; NSString* default_filename = nil; if (!default_path.empty()) { - default_dir = base::SysUTF8ToNSString(default_path.DirName().value()); - default_filename = base::SysUTF8ToNSString(default_path.BaseName().value()); + if (file_util::DirectoryExists(default_path)) { + default_dir = base::SysUTF8ToNSString(default_path.value()); + } else { + default_dir = base::SysUTF8ToNSString(default_path.DirName().value()); + default_filename = + base::SysUTF8ToNSString(default_path.BaseName().value()); + } } NSMutableArray* allowed_file_types = nil; |