tags:

views:

37

answers:

2

Hi, I am developing an application in cocoa which needs to copy a folder added to resource to other location in System/library .How can i specify the source and destination path.Looking for a solution

Thanks in advance

A: 

You'd use NSFileManager which has really nice convenient methods. There is method like

- (BOOL)copyItemAtPath:(NSString *)srcPath toPath:(NSString *)dstPath error:(NSError **)error

And here's the description of it from apple docs:

Copies the directory or file specified in a given path to a different location in the file system identified by another path.

Eimantas
This won't work because /System is a privileged location. You would need to run the copy in a separate tool which has been elevated to administrator privileges. An installer as suggested by Peter Hosey is the right answer here.
Rob Keniger
A: 

I am developing an application in cocoa which needs to copy a folder added to resource to other location in System/library .

  1. It sounds like you're writing an installer. Use PackageMaker; don't write your own custom installer. There are a thousand edge cases that Installer already handles and your custom installer will not.
  2. Do you really need to install this file in /System? The only kind of thing that absolutely needs to be there is a driver. If what you're installing is anything else, the answer is no, and you should not install it to /System.
Peter Hosey