Compare commits

..

2 commits

Author SHA1 Message Date
852c931d8b Comment out debug print
All checks were successful
Run Unit Tests / build-and-run-unit-tests (push) Successful in 5s
2024-07-24 15:05:01 +09:00
55cd3b2659 "Fix" windows build 2024-07-24 15:03:34 +09:00
2 changed files with 19 additions and 5 deletions

View file

@ -104,6 +104,9 @@ void cleanup_temp_filename_delete(void ***ptrs_array) {
}
char *filename_to_absolute_path(const char *filename) {
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
__attribute__((cleanup(free_malloced_memory))) void *path =
malloc(strlen(filename) + 1);
strncpy(path, filename, strlen(filename) + 1);
@ -138,6 +141,8 @@ char *filename_to_absolute_path(const char *filename) {
strlen(filename_basename) + 1);
return fullpath;
#endif
return NULL;
}
int write_files_fn(void *data, void *ud) {
@ -707,8 +712,12 @@ int write_files_fn(void *data, void *ud) {
// Need to get abs_path for checking/setting a flag before storing flags.
// Get absolute path.
__attribute__((cleanup(free_malloced_memory))) void *abs_path =
realpath(file_info->filename, NULL);
__attribute__((cleanup(free_malloced_memory))) void *abs_path = NULL;
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
abs_path = realpath(file_info->filename, NULL);
#endif
__attribute__((cleanup(free_malloced_memory))) void *rel_path = NULL;
if (abs_path) {
// Get relative path.
@ -873,8 +882,12 @@ int filenames_to_abs_map_fn(void *data, void *ud) {
// Try putting all parent dirs up to current working directory.
// First get absolute path to current working directory.
__attribute__((cleanup(free_malloced_memory))) void *cwd_dirname =
realpath(".", NULL);
__attribute__((cleanup(free_malloced_memory))) void *cwd_dirname = NULL;
#if SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_COSMOPOLITAN || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_MAC || \
SIMPLE_ARCHIVER_PLATFORM == SIMPLE_ARCHIVER_PLATFORM_LINUX
cwd_dirname = realpath(".", NULL);
#endif
if (!cwd_dirname) {
return 1;
}

View file

@ -388,7 +388,8 @@ SDArchiverLinkedList *simple_archiver_parsed_to_filenames(
strcmp(dir_entry->d_name, "..") == 0) {
continue;
}
fprintf(stderr, "dir entry in %s is %s\n", next, dir_entry->d_name);
// fprintf(stderr, "dir entry in %s is %s\n", next,
// dir_entry->d_name);
int combined_size = strlen(next) + strlen(dir_entry->d_name) + 2;
char *combined_path = malloc(combined_size);
snprintf(combined_path, combined_size, "%s/%s", next,