Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

__MACOSX 错处。 #14

Open
ShouBinCheng opened this issue Apr 26, 2019 · 0 comments
Open

__MACOSX 错处。 #14

ShouBinCheng opened this issue Apr 26, 2019 · 0 comments

Comments

@ShouBinCheng
Copy link

解压产生__MACOSX文件夹,当资质文件没首字母小于M时下载后移除文件操作错误。
应修改为:

+ (void)formatSakuraPath:(NSString *)sakuraPath cleanCachePath:(NSString * _Nullable)cachePath {
    if (!sakuraPath || !sakuraPath.length) return;
    if (cachePath) {
        [TXSakuraManager tx_clearSakuraCacheWithPath:cachePath];
    }
    NSFileManager *fileManager = [NSFileManager defaultManager];
    NSError *error = nil;
   //修改处 start
    NSMutableArray *folders = [fileManager contentsOfDirectoryAtPath:sakuraPath error:&error].mutableCopy;
    if ([folders containsObject:@"__MACOSX"]) {
        [folders removeObject:@"__MACOSX"];
    }
    //end
    NSString *folderName = sakuraPath.lastPathComponent;
    NSString *tempName = [folders.lastObject stringByAppendingString:folderName];
    NSString *moveItemPath = [sakuraPath stringByAppendingPathComponent:folders.lastObject];
    NSString *tempItemPath = [[sakuraPath stringByDeletingLastPathComponent] stringByAppendingPathComponent:tempName];
    [fileManager moveItemAtPath:moveItemPath toPath:tempItemPath error:&error];
    [fileManager removeItemAtPath:sakuraPath error:&error];
    [fileManager moveItemAtPath:tempItemPath toPath:sakuraPath error:&error];
#ifdef DEBUG
    NSLog(@"folders:%@", folders);
    NSLog(@"sakuraPath:%@--%@",sakuraPath, error);
#endif
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant