The "source" below is a mounted disc image (dmg), named "New." I'm trying to rename it with a textField string and action. When I complete the action the rename fails and I am unable to eject it. The code works with standard files and folders.
Also - if I do a "Get Info" of the mounted disc image and rename it there, everything works fine.
Bottom line is I want to rename a mounted disc image using a textField string. Can someone explain?
NSString *source = [@"~/Desktop/New" stringByExpandingTildeInPath];
NSString *newFile = [input stringValue];
NSString *newPath = [[source stringByDeletingLastPathComponent] stringByAppendingPathComponent:newFile];
[[NSFileManager defaultManager] moveItemAtPath:source toPath:newPath error:NULL];
NSLog(@"File renamed to %@", newFile);