diff options
Diffstat (limited to 'src/filepath.c')
-rw-r--r-- | src/filepath.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/filepath.c b/src/filepath.c index 2186881..b752e08 100644 --- a/src/filepath.c +++ b/src/filepath.c @@ -1,6 +1,6 @@ /* filepath.c * - * Copyright (c) 2014 Tharre + * Copyright (c) 2014-2017 Tharre * * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. @@ -125,3 +125,11 @@ void mkpath(char *path, mode_t mode) { *p = '/'; } } + +/* Make path absolute by prepending root, if path isn't already absolute. */ +char *make_abs(char *root, char *path) { + if (!is_absolute(path)) + return concat(3, root, "/", path); + else + return xstrdup(path); +} |