Это кажется странным, мой код выглядит так просто, как
// something like "foo/bar"
NSString *correctFileName = seriesDict[seriesNumber];
if (correctFileName.length > 0)
{
// So I'll have a fileName like "foo/bar.extension" which looks like a directory and a file in it...
NSString *pathExtension = [filePath pathExtension];
NSString *correctFilePath = [[[filePath stringByDeletingLastPathComponent]
stringByAppendingPathComponent:correctFileName]
stringByAppendingPathExtension:pathExtension];
NSError *error = nil;
[[NSFileManager defaultManager] moveItemAtPath:filePath toPath:correctFilePath error:&error];
// And NSFileManager can not treat it as a legal fileName, kind of expected...
if (error)
{
NSLog(@"Rename file at %@ failed, error: %@", filePath, error);
}
}
Кажется, можно переименовать мой файл в "foo / bar.extension" в Finder, например,
![enter image description here](https://i.stack.imgur.com/t2udC.png)
может быть решение для этого в коде.
Если кто-то мог бы крошиться в каком-то свете, это будет высоко оценено.