Add --relative-includes.

This commit is contained in:
Wilson Snyder
2017-02-09 18:33:18 -05:00
parent 15082a178b
commit 0adb789238
12 changed files with 91 additions and 6 deletions
+10
View File
@@ -25,6 +25,8 @@
#include <sys/types.h>
#include <dirent.h>
#include <unistd.h>
#include <climits>
#include <cstdlib>
#include <cerrno>
#include <fcntl.h>
#include <iomanip>
@@ -141,6 +143,14 @@ string V3Os::filenameSubstitute (const string& filename) {
}
string V3Os::filenameRealPath(const string& filename) {
// Get rid of all the ../ behavior in the middle of the paths.
// If there is a ../ that goes down from the 'root' of this path it is preserved.
char retpath[PATH_MAX];
realpath(filename.c_str(), retpath);
return string(retpath);
}
bool V3Os::filenameIsRel(const string& filename) {
return (filename.length()>0 && filename[0] != '/');
}