Here is my method that should simply move the contents of the directory from / someDirectory to / addons / id / UUID:
CFUUIDRef uuidObj = CFUUIDCreate(nil);
NSString *uuidString = (NSString*)CFUUIDCreateString(nil, uuidObj);
NSString *pathToAddon = [LWEFile createDocumentPathWithFilename:[NSString stringWithFormat:@"%@", relPath]];
NSString *pathToAddonDest = [LWEFile createDocumentPathWithFilename:[NSString stringWithFormat:@"addons/%@/%@", [character objectForKey:@"shortName"], uuidString]];
NSError* error;
if([[NSFileManager defaultManager] moveItemAtPath:pathToAddon toPath:pathToAddonDest error:&error] != YES)
{
NSLog(@"Unable to move file: %@", [error localizedDescription]);
}
[uuidString release];
CFRelease(uuidObj);
The transition is not performed. The operation could not be completed. (Cocoa error 4.). However, the same code works if I change pathToAddonDest to:
NSString *pathToAddonDest = [LWEFile createDocumentPathWithFilename:[NSString stringWithFormat:@"addons/%@", [character objectForKey:@"shortName"], uuidString]];
Therefore, I can write from / someDirectory to / addons / someDirectory, but not from / someDirectory to / addons / someDirectory / UUID.
Any ideas why a seemingly simple renaming wouldn't work this way?
source
share