Re: NSFileManager fileAttributesAtPath confusion
Re: NSFileManager fileAttributesAtPath confusion
- Subject: Re: NSFileManager fileAttributesAtPath confusion
- From: email@hidden
- Date: Thu, 6 Mar 2003 21:39:16 +0100
On jeudi, mars 6, 2003, at 07:46 PM, Chris Long wrote:
On Thursday, March 6, 2003, at 06:27 PM, Chris Long wrote:
Hey Everyone,
Ive got a small problem here where I am trying to get the size of
file at a path. The problem is when I change the path to a >
pointer(?).
NSDictionary *attributes = [[NSFileManager defaultManager]
fileAttributesAtPath:@"/tmp/somefile" traverseLink:NO];
This works perfectly fine for me however the path to the file is not
static so I am trying this with no luck.
NSString *path = [NSString
stingWithContentsOfFile:@"/tmp/filewithpathinfo"];
NSDictionary *attributes = [[NSFileManager defaultManager]
fileAttributesAtPath:path traverseLink:NO];
NSLog(@"%@", path);
I was just using hte NSLog to check if the path was right and it
reports the right path to the file like /Volumes/backup/somefile
Any thoughts?
Is it really the code you're using ?
This is the actual code I am using. I am a very novice programmer so
please bare with me.
NSString *path = [NSString
stingWithContentsOfFile:@"/tmp/filewithpathinfo"];
and not
NSString *path = [NSString stringWithString:@"/tmp/filewithpathinfo"];
In your code, you're putting the content of the file
/tmp/filewithpathinfo into your string. Does "/tmp/filewithpathinfo"
contain the path of the file?
The content of that file (filewithpathinfo) is the full path to an
actual file.
In that case, one possible cause of the problem you're facing is that
there is a CR or LF character in your filewithpathinfo content and
this/ese character is then in the NSString and in that case this is not
a valid path AFAIK.
_______________________________________________
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.