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];
|
file file = list->items[index];
|
||||||
char *name = strdup(file.path);
|
char *name = strdup(file.path);
|
||||||
|
name = basename(name);
|
||||||
|
if (name == NULL)
|
||||||
|
perror("ccc");
|
||||||
|
|
||||||
wchar_t *icon = wcsdup(file.icon);
|
wchar_t *icon = wcsdup(file.icon);
|
||||||
|
|
||||||
char *stats = NULL;
|
char *stats = NULL;
|
||||||
size_t length;
|
size_t length;
|
||||||
if (detail) {
|
if (detail) {
|
||||||
stats = strdup(file.stats);
|
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) {
|
if (stats == NULL) {
|
||||||
perror("ccc");
|
perror("ccc");
|
||||||
}
|
}
|
||||||
} else {
|
} 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));
|
char *line = memalloc(length * sizeof(char));
|
||||||
|
|
||||||
name = basename(name);
|
|
||||||
if (name == NULL)
|
|
||||||
perror("ccc");
|
|
||||||
|
|
||||||
if (detail) {
|
if (detail) {
|
||||||
snprintf(line, length, "%s %ls %s", stats, icon, name);
|
snprintf(line, length, "%s %ls %s", stats, icon, name);
|
||||||
|
|
Loading…
Reference in a new issue