• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Creating alias to app for PDFService
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Creating alias to app for PDFService
      • From: James Bucanek <email@hidden>
  • Prev by Date: Mailing List for Cocoa Newbies / Absolute Beginners
  • Next by Date: Re: Creating alias to app for PDFService
  • Previous by thread: Re: Saving an NSView to a file as an image.
  • Next by thread: Re: Creating alias to app for PDFService
  • Index(es):
    • Date
    • Thread