I’m doing an app that changes the Trash-icon in Mac OSX… so far I got:
- (IBAction)install:(id)sender {
NSLog(@"Installing..");
NSLog(@"Trying to move file..");
NSString* src = @"/Users/myuser/Desktop/dashboard.png";
NSString* target = @"/System/Library/CoreServices/Dock/Contents/Resources/tester123.png";
NSError* error = nil;
[[NSFileManager defaultManager] copyItemAtPath:src toPath:target error:&error];
if (error) {
NSLog(@"%@", error);
NSLog(@"%@", [error userInfo]);
}
}
I’m getting the error:
The operation couldn’t be completed. No such file or directory
I believe it’s because that Dock isnt a normal folder, but a package? How do I work around this? Or is there a better way to change the trash-icon?
Change your target to this (Dock becomes Dock.app):
You need administrative rights, otherwise you get this error:
This command works perfect in Terminal (conclusion: the path is correct).