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.

Thanks once again.
---Nikhil


-----Original Message-----
From: Corbin Dunn [mailto:corb...@apple.com]
Sent: Wednesday, March 17, 2010 10:43 PM
To: Matt Neuburg
Cc: Nikhil Khandelwal; cocoa-dev@lists.apple.com
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
> <nikhil_khandel...@persistent.co.in> 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



DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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 arch...@mail-archive.com

Reply via email to