Also Zip directory if use createZipFileAtPath:withFilesAtPaths:withPassword:
Hi, Like title, when I select more than one file path include file and directory, the directory lose data. And I always move all of them in one temporary directory and zip it. then remove the temporary directory.
Are you using the latest version of ZipArchive? (version 2.0.7 in September 2017)
Can you fork our project and modify either the ObjC example or the Swift example to demonstrate the issue?
Sorry about non clear question. I mean I hope the ZipArchive can support zip file and directory same time like this method: createZipFileAtPath:withFilesAtPaths:withPassword:.
I see. We could zip directories too with that method, but it would be also nicer to rename it in that case.
Now I solved this problem by create a temporary directory then copy files and folder which I wanna zip together in the temporary directory, then use createZipFileAtPath:withContentsOfDirectory to compress it.After success I remove the temporary directory. Do you have another better idea?
Your workaround is a valid approach. Another possibility for now would be to detect which entries are directories and then mix some:
-
- (BOOL)writeFolderAtPath:(NSString *)path withFolderName:(NSString *)folderName withPassword:(nullable NSString *)password; -
- (BOOL)writeFileAtPath:(NSString *)path withFileName:(nullable NSString *)fileName withPassword:(nullable NSString *)password;