+ small bug fix for windows

This commit is contained in:
kelson42 2011-12-20 20:11:56 +00:00
parent 784f87e715
commit 73217d5e49
1 changed files with 2 additions and 1 deletions

View File

@ -31,13 +31,14 @@ bool isRelativePath(const string &path) {
#endif #endif
} }
/* Warning: the relative path must be with slashes */
string computeAbsolutePath(const string path, const string relativePath) { string computeAbsolutePath(const string path, const string relativePath) {
#ifdef _WIN32 #ifdef _WIN32
string separator = "\\"; string separator = "\\";
#else #else
string separator = "/"; string separator = "/";
#endif #endif
string absolutePath = path[path.length() - 1] == '/' ? path : path + "/"; string absolutePath = path[path.length() - 1] == separator[0] ? path : path + separator;
char *cRelativePath = strdup(relativePath.c_str()); char *cRelativePath = strdup(relativePath.c_str());
char *token = strtok(cRelativePath, "/"); char *token = strtok(cRelativePath, "/");