librazor/util.c
changeset 441 cf499fd51df7
parent 424 8cbc438cc298
child 442 c4bcba8023a9
     1.1 --- a/librazor/util.c	Thu Feb 16 17:33:47 2012 +0000
     1.2 +++ b/librazor/util.c	Sat Aug 23 16:07:09 2014 +0100
     1.3 @@ -1,7 +1,7 @@
     1.4  /*
     1.5   * Copyright (C) 2008  Kristian Høgsberg <krh@redhat.com>
     1.6   * Copyright (C) 2008  Red Hat, Inc
     1.7 - * Copyright (C) 2009, 2011, 2012  J. Ali Harlow <ali@juiblex.co.uk>
     1.8 + * Copyright (C) 2009, 2011, 2012, 2014  J. Ali Harlow <ali@juiblex.co.uk>
     1.9   *
    1.10   * This program is free software; you can redistribute it and/or modify
    1.11   * it under the terms of the GNU General Public License as published by
    1.12 @@ -341,6 +341,24 @@
    1.13  	return concat;
    1.14  }
    1.15  
    1.16 +/**
    1.17 + * razor_path_add_root:
    1.18 + *
    1.19 + * Adds a root to a path. path must be an absolute pathname. In POSIX
    1.20 + * environments this is equivalent to the concationation of root and path.
    1.21 + * In Microsoft Windows an adjustment may need to be made for a drive letter
    1.22 + * in path (which will be dropped).
    1.23 + *
    1.24 + * Returns: The new pathname.
    1.25 + **/
    1.26 +RAZOR_EXPORT char *razor_path_add_root(const char *path, const char *root)
    1.27 +{
    1.28 +	if (root && *root)
    1.29 +		return razor_concat(root, SKIP_DRIVE_LETTER(path), NULL);
    1.30 +	else
    1.31 +		return strdup(path);
    1.32 +}
    1.33 +
    1.34  RAZOR_EXPORT const char *razor_system_arch(void)
    1.35  {
    1.36  #ifdef MSWIN_API