Compare commits

..

1 commit

Author SHA1 Message Date
783c0e11e7 Impl. simple test/extract new file format (WIP)
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 6s
TODO:
    Extract symlinks in new format.
    Extract compressed files in new format.
2024-09-27 15:40:11 +09:00

View file

@ -1054,9 +1054,6 @@ void cleanup_internal_file_info(SDArchiverInternalFileInfo **file_info) {
}
}
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
mode_t permissions_from_bits_version_1(const uint8_t flags[4],
uint_fast8_t print) {
mode_t permissions = 0;
@ -1136,7 +1133,6 @@ mode_t permissions_from_bits_version_1(const uint8_t flags[4],
return permissions;
}
#endif
char *simple_archiver_error_to_string(enum SDArchiverStateReturns error) {
switch (error) {
@ -1544,10 +1540,10 @@ int simple_archiver_parse_archive_version_0(FILE *in_f, int_fast8_t do_extract,
return SDAS_INVALID_FILE;
}
mode_t permissions = 0;
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
mode_t permissions = 0;
if (do_extract == 0) {
fprintf(stderr, " Permissions: ");
@ -2282,12 +2278,8 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract,
fprintf(stderr, "ERROR Files in chunk is larger than chunk!\n");
return SDAS_INTERNAL_ERROR;
} else if (do_extract) {
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
mode_t permissions =
permissions_from_bits_version_1(file_info->bit_flags, 0);
#endif
if ((state->parsed->flags & 8) == 0) {
// Check if file already exists.
__attribute__((cleanup(simple_archiver_helper_cleanup_FILE)))
@ -2313,13 +2305,9 @@ int simple_archiver_parse_archive_version_1(FILE *in_f, int_fast8_t do_extract,
return ret;
}
simple_archiver_helper_cleanup_FILE(&out_fd);
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
if (chmod(file_info->filename, permissions) == -1) {
return SDAS_INTERNAL_ERROR;
}
#endif
} else {
fprintf(stderr, " Permissions: ");
permissions_from_bits_version_1(file_info->bit_flags, 1);