0
libarchive
라이브러리를 사용하여 아카이브 항목의 이름을 바꾸려고합니다. 특히 나는 archive_entry_set_pathname
함수를 사용하고 있습니다.libarchive를 사용하여 아카이브의 비어 있지 않은 디렉토리의 이름을 변경하십시오.
파일과 빈 디렉토리의 이름이 올바르게 변경되었지만 디렉토리가 비어 있지 않으면 불행히도 작동하지 않습니다. 새 이름이 아닌 빈 디렉토리가 대상 디렉토리의 형제로 생성됩니다. 옛 이름이야.
관련 코드 : 비어 있지 않은 디렉토리 잘못 무엇
...
while (archive_read_next_header(inputArchive, &entry) == ARCHIVE_OK) {
if (file == QFile::decodeName(archive_entry_pathname(entry))) {
// FIXME: not working with non-empty directories
archive_entry_set_pathname(entry, QFile::encodeName(newPath));
}
int header_response;
if ((header_response = archive_write_header(outputArchive, entry)) == ARCHIVE_OK) {
... // write the (new) outputArchive on disk
}
}
?