From d37e2355f85c78c017e252596738207a7def6cda Mon Sep 17 00:00:00 2001 From: kelson42 Date: Mon, 13 Aug 2012 22:47:09 +0000 Subject: [PATCH] + in computeAbsolutePath(), if "root" path is empty, compute with the current path --- src/common/pathTools.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/common/pathTools.cpp b/src/common/pathTools.cpp index dd43a6d7..d9a04a0d 100644 --- a/src/common/pathTools.cpp +++ b/src/common/pathTools.cpp @@ -50,7 +50,16 @@ string computeAbsolutePath(const string path, const string relativePath) { #else string separator = "/"; #endif - string absolutePath = path[path.length() - 1] == separator[0] ? path : path + separator; + + string absolutePath; + if (path.empty()) { + char *path=NULL; + size_t size; + path = getcwd(path,size); + absolutePath = string(path) + separator; + } else { + absolutePath = path[path.length() - 1] == separator[0] ? path : path + separator; + } char *cRelativePath = strdup(relativePath.c_str()); char *token = strtok(cRelativePath, "/");