There is an older thread here about creating temp files when developing Spotlight plugins using XCode.
In brief, in the GetMetadataForFile
call, trying to create temp files/folders fails due to Spotlight sandboxing.
{
NSString* tempDir = NSTemporaryDirectory();
NSString* tempDirFolder = [tempDir stringByAppendingPathComponent:@"FinaleTempFiles"];
NSError* theError = nil;
BOOL fileOK = [[NSFileManager defaultManager] createDirectoryAtPath:tempDirFolder withIntermediateDirectories:NO attributes:nil error:&theError ];
if ( !fileOK )
NSLog(@"createDirectoryAtPath %@", [theError localizedDescription]);
}
NSLog output shows this Sandboxing violation:
2013-05-31 18:52:46.830 mdimport[43160:707] createDirectoryAtPath You don’t have permission to save the file “FinaleTempFiles” in the folder “T”.
I submitted a DTS ticket a few years ago, and essentially Apple admitted they weren't sure what they could do about it. If anyone has creative ideas on how to perform this, it would be extremely helpful.
If you're curious on why I'd like to do this, you can think (as an example) about running a shell command like unzip to extract a single file and then parsing it with another shell command.