On Mar 17, 2010, at 10:40 PM, Nikhil Khandelwal wrote: > Thanks a lot for your help. > I implemented the behavior by using "runmodalForDirectory: file:". In this I > took a bool variable which is false for first time and then true once save > panel is opened. For first time I used "setDirectory:@'Documents'" and if > user changed the location then "[savepanel directory]" and it is working > fine for me on 10.5 and 10.6. >
Well -- you shouldn't have to do that. It should just work if you use 'nil'. If you are just using a BOOL, it will make it happen the first time the app launches, every time. It won't persist across app launches. I think the problem you are running into is the user defaults. Try using nil, and moving aside your com.whatever.plist from the Preferences directory for testing. corbin > Thanks once again. > ---Nikhil > > > -----Original Message----- > From: Corbin Dunn [mailto:[email protected]] > Sent: Wednesday, March 17, 2010 10:43 PM > To: Matt Neuburg > Cc: Nikhil Khandelwal; [email protected] > Subject: Re: Directory to save file in NSSavePanel > > > On Mar 17, 2010, at 9:39 AM, Matt Neuburg wrote: > >> On Wed, 17 Mar 2010 13:40:35 +0530, Nikhil Khandelwal >> <[email protected]> said: >> >>> I am using NSSavePanel in my application. I am using "runModal" on this to >>> show the save panel. The default location it shows to save the file is >>> "Desktop" which I want to change to "Document". I tried >>> "runModalForDirectory" >>> as well however it uses the given file path as save location always. >>> Basically >>> I want NSSavePanel to use "Documents" as default save location and if user >>> change the location while saving the file, next time NSSavePanel should >>> shows >>> the changed location to save the file. >> >> If you're willing to be Snow Leopard only, a combination of directoryURL and >> setDirectoryURL might work. It's a little tricky otherwise because Mac OS X >> does automatically remember the last place the user saved, so the idea is to >> stay out of its way in that case. That info is kept in your user defaults so >> you might be able to examine it. m. > > Actually, the behavior Nikhi requested is the default behavior if you pass > 'nil' for the directory in the runModalForDirectory methods (or use it for > setDirectoryURL:) > > If you are using nil, it should default to Documents the first time. If it > didn't, then you probably need to wipe some user defaults (possibly in the > global domain and for the app). > > corbin _______________________________________________ Cocoa-dev mailing list ([email protected]) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
