Skip to content
Snippets Groups Projects
Commit f2b917ca authored by rswindell's avatar rswindell
Browse files

Fixed problem with Unix version of _fullpath - can't use cwd if chdir failed.

parent cb5fb036
No related branches found
No related tags found
No related merge requests found
...@@ -296,9 +296,12 @@ char* _fullpath(char* absPath, const char* relPath, size_t maxLength) ...@@ -296,9 +296,12 @@ char* _fullpath(char* absPath, const char* relPath, size_t maxLength)
} }
getcwd(curdir, PATH_MAX); getcwd(curdir, PATH_MAX);
chdir(relPath); if(chdir(relPath)!=0) /* error, invalid dir */
strcpy(absPath,relPath);
else {
getcwd(absPath, maxLength); getcwd(absPath, maxLength);
chdir(curdir); chdir(curdir);
}
free(curdir); free(curdir);
return absPath; return absPath;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment