mirror of
https://code.blicky.net/yorhel/ncdu.git
synced 2026-01-13 01:08:41 -09:00
Fixed display of the root directory
This commit is contained in:
parent
9cc79b0fab
commit
ece21a668d
2 changed files with 10 additions and 3 deletions
10
src/calc.c
10
src/calc.c
|
|
@ -344,9 +344,13 @@ void calc_process() {
|
||||||
strcpy(t->name, orig->name);
|
strcpy(t->name, orig->name);
|
||||||
} else {
|
} else {
|
||||||
t->name = malloc(strlen(path)+strlen(name)+1);
|
t->name = malloc(strlen(path)+strlen(name)+1);
|
||||||
strcpy(t->name, path);
|
if(strcmp(path, "/"))
|
||||||
strcat(t->name, "/");
|
strcpy(t->name, path);
|
||||||
strcat(t->name, name);
|
if(strcmp(name, ".")) {
|
||||||
|
strcat(t->name, "/");
|
||||||
|
strcat(t->name, name);
|
||||||
|
} else
|
||||||
|
t->name[0] = 0;
|
||||||
}
|
}
|
||||||
root = t;
|
root = t;
|
||||||
curdev = fs.st_dev;
|
curdev = fs.st_dev;
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,9 @@ char *getpath(struct dir *cur) {
|
||||||
struct dir *d, **list;
|
struct dir *d, **list;
|
||||||
int c, i;
|
int c, i;
|
||||||
|
|
||||||
|
if(!cur->name[0])
|
||||||
|
return "/";
|
||||||
|
|
||||||
c = i = 1;
|
c = i = 1;
|
||||||
for(d=cur; d!=NULL; d=d->parent) {
|
for(d=cur; d!=NULL; d=d->parent) {
|
||||||
i += strlen(d->name)+1;
|
i += strlen(d->name)+1;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue