Creating alias to app for PDFService
Creating alias to app for PDFService
- Subject: Creating alias to app for PDFService
- From: Antonio Nunes <email@hidden>
- Date: Sun, 30 Apr 2006 14:20:32 +0100
Hi,
I'm trying to get my app to install itself as a PDF Service. Although
I manage to create the PDFService directory if it doesn't yet exist,
I can't get the alias to be created. The code I've written for it
looks like this:
- (IBAction)installAsPDFService:(id)sender
{
NSArray *paths;
BOOL isDir = NO, exists = NO, success = NO;
NSFileManager *fileManager = [NSFileManager defaultManager];
NSString *pdfServiceDirectoryPath, *myAppAliasPath, *myAppPath;
paths = NSSearchPathForDirectoriesInDomains(NSLibraryDirectory,
NSUserDomainMask, YES);
if ([paths count] > 0) { // only copying one file
pdfServiceDirectoryPath = [[paths objectAtIndex:0]
stringByAppendingPathComponent:@"PDF Services"];
exists = [fileManager fileExistsAtPath:pdfServiceDirectoryPath
isDirectory:&isDir];
if (!isDir) {
// There is no PDF Services directory so create it
[fileManager createDirectoryAtPath:pdfServiceDirectoryPath
attributes:nil];
}
myAppAliasPath = [pdfServiceDirectoryPath
stringByAppendingPathComponent:@"myApp"];
exists = [fileManager fileExistsAtPath:myAppAliasPath];
if (!exists) {
// There is no alias to myApp so create it
myAppPath = [[[NSBundle mainBundle] bundlePath]
stringByDeletingPathExtension];
success = [fileManager linkPath:myAppPath
toPath:pdfServiceDirectoryPath handler:nil];
}
}
}
But the last call to the linkPath method always returns NO and no
alias is created. I've tried the myAppPath with and without the path
extension. No joy either way. Can anybody tell me where I'm going wrong?
Thanks,
António _______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden