• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSDocument setFileName - File Must Exist?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSDocument setFileName - File Must Exist?


  • Subject: NSDocument setFileName - File Must Exist?
  • From: Seth Willits <email@hidden>
  • Date: Sun, 30 Jan 2005 22:07:50 -0800

In an attempt to replicate a feature similar to Xcode's New Project window, I used NSDocumentController's makeUntitledDocumentOfType: method to create a new document instance, and then used NSDocument setFileName: to specify where the file is located. When the document is asked to save though (with saveDocument) it says it doesn't know where it should save the file to, and then brings up a save dialog which is precisely what I'm trying to prevent.

With a bit of detective work I've figured out that saveDocument "doesn't know" where the file is located because the file set with setFileName doesn't yet exist. If it does already exist, my method works fine. So as a workaround, I can create an empty file first and then subsequent calls to saveDocument won't ask where to save it to, but I'm thinking I'm missing something.

Any ideas?



Seth Willits
------------------------------------------------------------------------ ---
President and Head Developer of Freak Software - http://www.freaksw.com
REALbasic Guru at ResExcellence - http://www.resexcellence.com/realbasic


"Yesterday we obeyed kings and bent our necks before emperors. But
today we kneel only to truth, follow only beauty, and obey only love."
-- Kahlil Gibran
------------------------------------------------------------------------ ---


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Prev by Date: Dock on Both Displays?
  • Next by Date: Re: Highlighting Cell Problem
  • Previous by thread: Re: Dock on Both Displays?
  • Next by thread: Invalid value of the string instance variables
  • Index(es):
    • Date
    • Thread