-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfile_functions.h
33 lines (26 loc) · 943 Bytes
/
file_functions.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#ifndef FILE_FUNCTIONS_H
#define FILE_FUNCTIONS_H
#include <string>
#include <set>
#include <algorithm>
#include <iterator>
#include <boost/filesystem.hpp>
#include <boost/system/error_code.hpp>
namespace file_functions {
/**
* Convert a path to a canonical path, but if the path refers to a symlink,
* don't follow it.
*/
boost::filesystem::path getCanonicalPathToSymlink(const boost::filesystem::path &p, boost::system::error_code &ec);
/**
* Normalize a path by removing "." and "..". Not necessarily correct if the
* path contains symlinks. Should be used only if getCanonicalPathToSymlink
* fails.
*/
boost::filesystem::path normalizePath(const boost::filesystem::path &p);
/**
* Convert a path to a relative path with respect to its prefix.
*/
boost::filesystem::path removePathPrefix(const boost::filesystem::path &p, const boost::filesystem::path &prefix);
}
#endif /* FILE_FUNCTIONS_H */