diff --git a/.gitignore b/.gitignore index 6423617..6d8accf 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ build/ assets/demo-dir .cache/ +test + compile_commands.json .quickmarks diff --git a/include/cli.h b/include/cli.h index 3cbb798..7e13a8f 100644 --- a/include/cli.h +++ b/include/cli.h @@ -4,7 +4,7 @@ #include #include -#define LASER_VERSION "1.7.0" +#define LASER_VERSION "1.7.1" typedef struct laser_opts { diff --git a/src/laser.c b/src/laser.c index 62e3097..69b228f 100644 --- a/src/laser.c +++ b/src/laser.c @@ -82,8 +82,7 @@ void laser_process_single_file(laser_opts opts) longest_ownername = strlen(ownername); // this has to be the longest name // cus it be the ownly name - laser_print_entry(&entry, LASER_COLORS[LASER_COLOR_FILE].value, "", 0, opts, - 1); + laser_handle_entry(&entry, opts.dir, "", 0, opts, 1); free(entry.d); } @@ -295,14 +294,15 @@ static void laser_handle_entry(struct laser_dirent *entry, strerror(errno)); ent->s = entry->s; - ent->d = malloc(offsetof(struct dirent, d_name) + - strlen(res_string) + 1); + ent->d = malloc(sizeof(struct dirent)); if (ent->d == NULL) laser_logger_fatal(1, "Failed to allocate entry struct: %s", strerror(errno)); strcpy(ent->d->d_name, res_string); + ent->git_status = entry->git_status; + laser_print_entry(ent, LASER_COLORS[LASER_COLOR_SYMLINK].value, indent, depth, opts, is_last); @@ -432,8 +432,9 @@ static void laser_print_entry(struct laser_dirent *entry, const char *color, printf("%s%s%s%s%s", indent, branch, color, entry->d->d_name, LASER_COLORS[LASER_COLOR_RESET].value); - if (entry->git_status && entry->git_status != ' ') - printf("\x1b[33m [%c]\x1b[0m", entry->git_status); + (entry->git_status && entry->git_status != ' ') + ? printf("\x1b[33m [%c]\x1b[0m", entry->git_status) + : 0; printf("\n"); }