Re: Using a string as filepath
Re: Using a string as filepath
- Subject: Re: Using a string as filepath
- From: Knut Lorenzen <email@hidden>
- Date: Fri, 28 Nov 2008 20:52:51 +0100
Am 28.11.2008 um 19:22 schrieb Tommy Nordgren:
try using -[NSString fileSystemRepresentation]
Actually, that was my 1st attempt :)
Meanwhile I have a solution better than replacing all potentially
"evil" characters with an underscore:
for( i = 0; i < [temporaryPath length]; i++) {
if( [temporaryPath characterAtIndex: i] < 0x20 ) [cleanPath
appendString: @" "];
// replace non-printable chars with a space
else if( [temporaryPath characterAtIndex: i] == ':' ) [cleanPath
appendString: @"-"];
//replace directory identifier with a dash
else [cleanPath appendFormat: @"%C", [temporaryPath characterAtIndex:
i]];
// let others go through
}
Cheers,
Knut
_______________________________________________
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