/* NSWorkspace: Return the user's temporary directory Original Source: (See copyright notice at ) */ /*" Return the user's temporary directory path. Sure, you could just hard-wire something in /tmp, but this is wraps the official Carbon FindFolder technique. "*/ - (NSString *) temporaryDirectory { char s[1024]; FSSpec spec; FSRef ref; short vRefNum; long dirID; if ( FindFolder( kOnAppropriateDisk, kChewableItemsFolderType, true, &vRefNum, &dirID ) == noErr ) { FSMakeFSSpec( vRefNum, dirID, "", &spec ); if ( FSpMakeFSRef(&spec, &ref) == noErr ) { FSRefMakePath(&ref, s, sizeof(s)); return [NSString stringWithUTF8String:s]; // not sure if s is in UTF8 encoding: What's opposite of -[NSString fileSystemRepresentation]? } } return nil; }