On Jan 15, 2015, at 6:16 PM, Jerry Krinock <je...@ieee.org> wrote: > I have noticed that the directory which is navigated to in the File > Open > dialog of my NSDocument-based application does not give what I expect, and am > trying to control it.
> So, great, I thought, just override -currentDirectory in the > NSDocumentController subclass for TextEdit, and I can make it go wherever I > want to. > > But, no. Although my -currentDirectory override is invoked when I click menu > > File > Open, any path I return seems to be ignored. That's unfortunate. It definitely seems like that should have worked. > If no document is open (no “current document”), it seems to always somehow > remember and go to the directory of the last document that was opened, even > if this was in a long-app application run. This is the case even if I delete > the “recents” file > ~/Library/Preferences/com.apple.TextEdit.LSSharedFileList.plist before > launching. And no such path is shown when I run the command “defaults > com.appleTextEdit”. The system must be remembering this path elsewhere. On my 10.9.5 system, the last location is remembered in the defaults for TextEdit. The command "defaults read com.apple.TextEdit NSNavLastRootDirectory" provides it. > Presumably I could get the control I want by overriding and re-implementing > -openDocument: to actually use -currentDirectory the way the documentation > says it should. It should be a lot less lines of code than I’ve written in > this message. But before I do that I’m asking if anyone else has been here > and done anything similar. I think you should override -runModalOpenPanel:forTypes: and -beginOpenPanel:forTypes:completionHandler:. In each, you would customize the Open panel by setting the directoryURL property and then call through to super. Regards, Ken _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com