mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-21 04:50:59 +00:00
Make NSOpenPanel and NSSavePanel consistently start up in the last
used directory by default. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27220 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
c476e3fa6d
commit
51ae4e18a6
4 changed files with 46 additions and 23 deletions
|
@ -60,7 +60,6 @@ static NSString *CFBundleTypeName = @"CFBundleTypeName";
|
|||
static NSString *CFBundleTypeRole = @"CFBundleTypeRole";
|
||||
|
||||
static NSString *NSRecentDocuments = @"NSRecentDocuments";
|
||||
static NSString *NSDefaultOpenDirectory = @"NSDefaultOpenDirectory";
|
||||
|
||||
static NSDocumentController *sharedController = nil;
|
||||
|
||||
|
@ -728,10 +727,6 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
NSString *cancelString = (cancellable)? ((NSString *)_(@"Cancel")) : ((NSString *)nil);
|
||||
int result;
|
||||
|
||||
/* Probably as good a place as any to do this */
|
||||
[[NSUserDefaults standardUserDefaults]
|
||||
setObject: [self currentDirectory] forKey: NSDefaultOpenDirectory];
|
||||
|
||||
if (![self hasEditedDocuments])
|
||||
{
|
||||
return YES;
|
||||
|
@ -850,13 +845,19 @@ static NSDictionary *TypeInfoForHumanReadableName (NSArray *types, NSString *typ
|
|||
{
|
||||
NSFileManager *manager = [NSFileManager defaultManager];
|
||||
NSDocument *document = [self currentDocument];
|
||||
NSString *directory;
|
||||
NSString *directory = nil;
|
||||
BOOL isDir = NO;
|
||||
|
||||
if (document)
|
||||
directory = [[document fileName] stringByDeletingLastPathComponent];
|
||||
else
|
||||
directory = [[NSOpenPanel openPanel] directory];
|
||||
{
|
||||
directory = [[document fileName] stringByDeletingLastPathComponent];
|
||||
}
|
||||
if (directory == nil || [directory isEqual: @""]
|
||||
|| [manager fileExistsAtPath: directory isDirectory: &isDir] == NO
|
||||
|| isDir == NO)
|
||||
{
|
||||
directory = [[NSOpenPanel openPanel] directory];
|
||||
}
|
||||
if (directory == nil || [directory isEqual: @""]
|
||||
|| [manager fileExistsAtPath: directory isDirectory: &isDir] == NO
|
||||
|| isDir == NO)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue