diff -r 8cbc438cc298 -r cf499fd51df7 librazor/util.c --- a/librazor/util.c Thu Feb 16 17:33:47 2012 +0000 +++ b/librazor/util.c Sat Aug 23 16:07:09 2014 +0100 @@ -1,7 +1,7 @@ /* * Copyright (C) 2008 Kristian Høgsberg * Copyright (C) 2008 Red Hat, Inc - * Copyright (C) 2009, 2011, 2012 J. Ali Harlow + * Copyright (C) 2009, 2011, 2012, 2014 J. Ali Harlow * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -341,6 +341,24 @@ return concat; } +/** + * razor_path_add_root: + * + * Adds a root to a path. path must be an absolute pathname. In POSIX + * environments this is equivalent to the concationation of root and path. + * In Microsoft Windows an adjustment may need to be made for a drive letter + * in path (which will be dropped). + * + * Returns: The new pathname. + **/ +RAZOR_EXPORT char *razor_path_add_root(const char *path, const char *root) +{ + if (root && *root) + return razor_concat(root, SKIP_DRIVE_LETTER(path), NULL); + else + return strdup(path); +} + RAZOR_EXPORT const char *razor_system_arch(void) { #ifdef MSWIN_API