mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
If you call makepath() with an absolute name it returns a copy of it
This commit is contained in:
parent
9407399230
commit
4b1b156a3b
15
noice.c
15
noice.c
|
@ -490,11 +490,16 @@ makepath(char *dir, char *name)
|
||||||
{
|
{
|
||||||
char *path;
|
char *path;
|
||||||
|
|
||||||
/* Handle root case */
|
/* Handle absolute path */
|
||||||
if (strcmp(dir, "/") == 0)
|
if (name[0] == '/') {
|
||||||
asprintf(&path, "/%s", name);
|
path = xstrdup(name);
|
||||||
else
|
} else {
|
||||||
asprintf(&path, "%s/%s", dir, name);
|
/* Handle root case */
|
||||||
|
if (strcmp(dir, "/") == 0)
|
||||||
|
asprintf(&path, "/%s", name);
|
||||||
|
else
|
||||||
|
asprintf(&path, "%s/%s", dir, name);
|
||||||
|
}
|
||||||
|
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue