Irritating Problem with NSString Method and File Paths
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