Re: NSFileManager fileAttributesAtPath confusion
Re: NSFileManager fileAttributesAtPath confusion
- Subject: Re: NSFileManager fileAttributesAtPath confusion
- From: Sherm Pendley <email@hidden>
- Date: Fri, 7 Mar 2003 11:27:34 -0500
On Friday, March 7, 2003, at 11:03 AM, Chris Long wrote:
NSString *path = [NSString
stringWithContentsOfFile:@"/tmp/filewithpathinfo"];
NSLog(@"-%@-", path) will give me
-/usr/bin/tail
-
So it looks like that may be my problem. Any way you can help me fix
that?
It looks like your problem is that the path stored in the file ends with
a trailing newline - \n.
I can think of two potential solutions:
1. If you're creating this file - either through code or by hand - don't
add a newline to the end of it. (Patient: Doctor, it hurts when I do
this. Doc: Then don't do that...)
2. Strip any trailing newlines off the string before using it. That
doesn't really fix the true cause of the problem, it just patches the
symptom. And, it's more work.
sherm--
The wise programmer is told about Tao and follows it. The average
programmer is told about Tao and searches for it. The foolish programmer
is told about Tao and laughs at it.
If it were not for laughter, there would be no Tao.
-- The Tao of Programming
_______________________________________________
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.