confstr + [NSFileManager stringWithFileSystemRepresentation:length:] crash on Leopard
confstr + [NSFileManager stringWithFileSystemRepresentation:length:] crash on Leopard
- Subject: confstr + [NSFileManager stringWithFileSystemRepresentation:length:] crash on Leopard
- From: Vera Tkachenko <email@hidden>
- Date: Wed, 4 Aug 2010 17:49:39 +0300
Hello,
in my application I need to obtain system cache directory (not ~/Library/Caches). To perform this I use code "borrowed" from WebKit (that why I think it's correct :) )
char cacheDirectory[MAXPATHLEN];
size_t cacheDirectoryLen = confstr(_CS_DARWIN_USER_CACHE_DIR, cacheDirectory, MAXPATHLEN);
if (cacheDirectoryLen)
leoUserCacheDir = [[[NSFileManager defaultManager] stringWithFileSystemRepresentation:cacheDirectory length:cacheDirectoryLen - 1] retain];
It works OK but sometimes (it happens for some users) this "simple" and straightforward code crashes. Here is a crash sample:
Thread 0 Crashed:
0 libSystem.B.dylib 0xffff0ebb __memcpy 1819 (cpu_capabilities.h:246)
1 com.apple.CoreFoundation 0x91dd1cba __CFStringDecodeByteStream3 2794
2 com.apple.CoreFoundation 0x91db8fa9 __CFStringCreateImmutableFunnel3 409
3 com.apple.CoreFoundation 0x91dba20e CFStringCreateWithBytes 94
4 com.apple.Foundation 0x925dd238 -[NSFileManager stringWithFileSystemRepresentation:length:] 72
<skipped app backtrace>
And from this crash I can't figure out what's wrong with this user's systems...
Any advice gratefully received.
--
Thanks in advance,
Vera Tkachenko_______________________________________________
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