summaryrefslogtreecommitdiff
path: root/src/boost-utils.cc
diff options
context:
space:
mode:
authordon bright <hugh.m.bright@gmail.com>2013-03-17 17:34:47 (GMT)
committerdon bright <hugh.m.bright@gmail.com>2013-03-17 17:34:47 (GMT)
commit100b1733df981aa542675d2dad198a259a61ccd2 (patch)
tree6b93a88cf634fa2d1b7abbf9cea7511593718f39 /src/boost-utils.cc
parentc855e4d0436a01792b540c7857e1a1997f4810d7 (diff)
backport boost functions to pre-1.48
Diffstat (limited to 'src/boost-utils.cc')
-rw-r--r--src/boost-utils.cc18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/boost-utils.cc b/src/boost-utils.cc
index 5127047..534cbaa 100644
--- a/src/boost-utils.cc
+++ b/src/boost-utils.cc
@@ -1,3 +1,4 @@
+#include "boosty.h"
#include "boost-utils.h"
#include <stdio.h>
#include <iostream>
@@ -7,8 +8,8 @@
fs::path boostfs_relative_path(const fs::path &path, const fs::path &relative_to)
{
// create absolute paths
- fs::path p = fs::absolute(boostfs_normalize(path));
- fs::path r = fs::absolute(relative_to);
+ fs::path p = boosty::absolute(boostfs_normalize(path));
+ fs::path r = boosty::absolute(relative_to);
// if root paths are different, return absolute path
if (p.root_path() != r.root_path())
@@ -46,16 +47,17 @@ fs::path boostfs_relative_path(const fs::path &path, const fs::path &relative_to
// Will normalize the given path, i.e. remove any redundant ".." path elements.
fs::path boostfs_normalize(const fs::path &path)
{
- fs::path absPath = absolute(path);
+ fs::path absPath = boosty::absolute(path);
fs::path::iterator it = absPath.begin();
- fs::path result = *it++;
+ fs::path result = *it;
+ if (it!=absPath.end()) it++;
// Get canonical version of the existing part
for(;exists(result) && it != absPath.end(); ++it) {
result /= *it;
}
- result = canonical(result.parent_path());
- --it;
+ result = boosty::canonical(result.parent_path());
+ if (it!=absPath.begin()) it--;
// For the rest remove ".." and "." in a path with no symlinks
for (; it != absPath.end(); ++it) {
@@ -98,8 +100,8 @@ boostfs_uncomplete(fs::path const p, fs::path const base)
which it most likely is... but then base shouldn't be a filename so... */
// create absolute paths
- fs::path abs_p = fs::absolute(boostfs_normalize(p));
- fs::path abs_base = fs::absolute(base);
+ fs::path abs_p = boosty::absolute(boostfs_normalize(p));
+ fs::path abs_base = boosty::absolute(base);
fs::path from_path, from_base, output;
contact: Jan Huwald // Impressum