assert(path);
if (!isempty(root))
- return strjoin(root, "/",
+ return strjoin(root, endswith(root, "/") ? "" : "/",
path[0] == '/' ? path+1 : path,
- rest ? "/" : NULL,
+ rest ? (endswith(path, "/") ? "" : "/") : NULL,
rest && rest[0] == '/' ? rest+1 : rest,
NULL);
else
return strjoin(path,
- rest ? "/" : NULL,
+ rest ? (endswith(path, "/") ? "" : "/") : NULL,
rest && rest[0] == '/' ? rest+1 : rest,
NULL);
}