• 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
Irritating Problem with NSString Method and File Paths
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Irritating Problem with NSString Method and File Paths


  • Subject: Irritating Problem with NSString Method and File Paths
  • From: Patrick Walker <email@hidden>
  • Date: Mon, 4 Aug 2008 01:43:07 -0300

It seems that whenever I use Xcode to spawn the program, it is able to find the file but when spawning the program from Finder, it can never, ever find the file. I've been looking online and no one seems to have come across this before or maybe it's because it's so late that I'm not seeing the obvious.

NSString *fileContents = [[NSString alloc] initWithContentsOfFile: [filename stringValue]
encoding:NSASCIIStringEncoding
error:nil];
Filename is an NSTextField outlet, btw.


We've tried all sorts of things to try and find the file, File.txt, ./ File.txt, ~/File.txt, "./File.txt". I can understand maybe the ~ doesn't work for all shells but explicitly using
./File.txt should be opening the file in the current directory with the executable, shouldn't it? Do I *really* have to append a huge long path each time I want to open a file?


Any ideas? It says path and the documentation says that it has to be NSString. I've used filepaths before for open() but those are C strings and those are full paths though, i.e., /dev/stdout. It's such a simple problem what am I missing here?
_______________________________________________


Cocoa-dev mailing list (email@hidden)

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:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Irritating Problem with NSString Method and File Paths
      • From: Negm-Awad Amin <email@hidden>
    • Re: Irritating Problem with NSString Method and File Paths
      • From: Jack Carbaugh <email@hidden>
    • Re: Irritating Problem with NSString Method and File Paths
      • From: Phil <email@hidden>
  • Prev by Date: Re: NSImage size vs. representations' sizes
  • Next by Date: Re: Irritating Problem with NSString Method and File Paths
  • Previous by thread: Re: Cocoa / AppleScript Folder Action
  • Next by thread: Re: Irritating Problem with NSString Method and File Paths
  • Index(es):
    • Date
    • Thread