From: Arvin Schnell Date: Mon, 16 Feb 2015 10:44:45 +0000 (+0100) Subject: - added function to prepend root-prefix X-Git-Tag: v0.2.6~1^2~18 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=13329136e467052eb03d61e2c7266af4556fc75f;p=thirdparty%2Fsnapper.git - added function to prepend root-prefix --- diff --git a/snapper/AppUtil.cc b/snapper/AppUtil.cc index ed76005e..9eb17d33 100644 --- a/snapper/AppUtil.cc +++ b/snapper/AppUtil.cc @@ -142,6 +142,16 @@ namespace snapper } + string + prepend_root_prefix(const string& root_prefix, const string& path) + { + if (root_prefix == "/") + return path; + else + return root_prefix + path; + } + + string dirname(const string& name) { diff --git a/snapper/AppUtil.h b/snapper/AppUtil.h index 1b0b0d82..c735a9df 100644 --- a/snapper/AppUtil.h +++ b/snapper/AppUtil.h @@ -57,6 +57,8 @@ namespace snapper string realpath(const string& path); + string prepend_root_prefix(const string& root_prefix, const string& path); + string stringerror(int errnum); string dirname(const string& name);