fix filename partial shown
This commit is contained in:
parent
53dd0e16c5
commit
1e0ce67a7f
1 changed files with 8 additions and 5 deletions
13
file.c
13
file.c
|
@ -129,23 +129,26 @@ char *get_line(ArrayList *list, long index, bool detail)
|
|||
{
|
||||
file file = list->items[index];
|
||||
char *name = strdup(file.path);
|
||||
name = basename(name);
|
||||
if (name == NULL)
|
||||
perror("ccc");
|
||||
|
||||
wchar_t *icon = wcsdup(file.icon);
|
||||
|
||||
char *stats = NULL;
|
||||
size_t length;
|
||||
if (detail) {
|
||||
stats = strdup(file.stats);
|
||||
length = strlen(name) + strlen(stats) + 2; /* one for space and one for null */
|
||||
length = strlen(name) + strlen(stats) + 7; /* 4 for icon, 2 for space and 1 for null */
|
||||
if (stats == NULL) {
|
||||
perror("ccc");
|
||||
}
|
||||
} else {
|
||||
length = strlen(name) + 2; /* one for space and one for null */
|
||||
length = strlen(name) + 6; /* 4 for icon, 1 for space and 1 for null */
|
||||
}
|
||||
char *line = memalloc(length * sizeof(char));
|
||||
|
||||
name = basename(name);
|
||||
if (name == NULL)
|
||||
perror("ccc");
|
||||
|
||||
|
||||
if (detail) {
|
||||
snprintf(line, length, "%s %ls %s", stats, icon, name);
|
||||
|
|
Loading…
Reference in a new issue