If I create a url a la:
const UInt8 *pFilepath = (const UInt8 *)[[NSHomeDirectory() stringByAppendingString:@"/Documents/"] UTF8String];
CFURLRef ldestination = CFURLCreateFromFileSystemRepresentation (NULL, pFilepath, strlen((const char*)pFilepath), false);
and then log it to see what I've got a la:
NSLog(@"destination url:%@",(NSString*)ldestination);
the trailing slash on "/Documents/" is removed. Not a problem if it's not important. But when I do
dirPath = CFURLHasDirectoryPath(ldestination);
if (!dirPath) {
fprintf(stderr, "no dice");
return false;
}
the error is thrown. If instead, I pass an NSString which includes the trailing slash, it doesn't error on the CFURLHasDirectoryPath, but won't pass a
writeStream = CFWriteStreamCreateWithFile(kCFAllocatorDefault, ldestination);
assert(writeStream != NULL);
And idea what's going on? Ideally, I think that if I can keep the trailing slash on the CFURLRef, it'll pass the errors, but I don't know that for sure.
Any thoughts?
Thanks.