Compare commits

..

No commits in common. "852c931d8b09f926fe561978cdee1ddbf00343dc" and "d8068a6f5f8999dd274e25603a15df2f987af3b3" have entirely different histories.

2 changed files with 5 additions and 19 deletions

View file

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

View file

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