• 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
Re: Filename
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Filename


  • Subject: Re: Filename
  • From: Alex Rice <email@hidden>
  • Date: Wed, 20 Mar 2002 21:38:57 -0700

On Wednesday, March 20, 2002, at 02:49 PM, Jason Reece wrote:

Please help.

I am a beginner programmer in Cocoa and Objective C.

I need to get the path and filename of a file that I've opened so I can process it. I'm porting an existing app. which needs it.

Currently my Cocoa bit works fine in opening the file and displaying it (using NSTextView and an associated NIB file), but how do I get the filename and path?


I am guessing you are using an NSDocument based Cocoa project? If so, then you can just do in your NSDocument class:

NSString *myFileName = [self fileName];

NSString has a bunch of methods for twiddling with pathnames and filenames, and there is also NSURL.

If this isn't helpful, maybe you can describe more about your app- how have you managed to already load the file into an NSTextView without knowing the filename?

Alex Rice <email@hidden>
Mindlube Software
http://www.mindlube.com/
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Filename (From: Jason Reece <email@hidden>)

  • Prev by Date: Re: drag-and-drop support in an NSTableView
  • Next by Date: NSBitmapImageRep & .rgb? .sgi?
  • Previous by thread: Filename
  • Next by thread: isKindOfClass vs. loading bundles: nope?!?!?!?
  • Index(es):
    • Date
    • Thread