summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/kwsys/SystemTools.cxx16
-rw-r--r--Source/kwsys/SystemTools.hxx.in4
2 files changed, 17 insertions, 3 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 65f6259..a46cc5b 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -205,6 +205,10 @@ inline void Realpath(const char *path, kwsys_stl::string & resolved_path)
resolved_path = fullpath;
KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path);
}
+ else
+ {
+ resolved_path = path;
+ }
}
#else
#include <sys/types.h>
@@ -237,8 +241,16 @@ inline void Realpath(const char *path, kwsys_stl::string & resolved_path)
{
char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
- realpath(path, resolved_name);
- resolved_path = resolved_name;
+ char *ret = realpath(path, resolved_name);
+ if(ret)
+ {
+ resolved_path = ret;
+ }
+ else
+ {
+ // if path resolution fails, return what was passed in
+ resolved_path = path;
+ }
}
#endif
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index b092764..07118c2 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -351,7 +351,9 @@ public:
const char* in_base);
/**
- * Get the real path for a given path, removing all symlinks.
+ * Get the real path for a given path, removing all symlinks. In
+ * the event of an error (non-existent path, permissions issue,
+ * etc.) the original path is returned.
*/
static kwsys_stl::string GetRealPath(const char* path);