summaryrefslogtreecommitdiffstats
path: root/Source/kwsys
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2004-10-05 14:59:07 (GMT)
committerBill Hoffman <bill.hoffman@kitware.com>2004-10-05 14:59:07 (GMT)
commit7f17646576395311064c3852c0f573036c63f0bb (patch)
tree23ee33e9332abbb1be872db1126bc2e7d287984c /Source/kwsys
parent1aab11b8db92a63b0006e414d50bf6704e714879 (diff)
downloadCMake-7f17646576395311064c3852c0f573036c63f0bb.zip
CMake-7f17646576395311064c3852c0f573036c63f0bb.tar.gz
CMake-7f17646576395311064c3852c0f573036c63f0bb.tar.bz2
BUG: fix realpath problem and unix slashes
Diffstat (limited to 'Source/kwsys')
-rw-r--r--Source/kwsys/SystemTools.cxx37
1 files changed, 18 insertions, 19 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 2064691..3a513e6 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -68,16 +68,15 @@ inline int Chdir(const char* dir)
return _chdir(dir);
#endif
}
-inline char *Realpath(const char *path, char *resolved_path)
+inline void Realpath(const char *path, kwsys_stl::string & resolved_path)
{
char *ptemp;
char fullpath[MAX_PATH];
if( GetFullPathName(path, sizeof(fullpath), fullpath, &ptemp) )
{
- return strcpy(resolved_path, fullpath);
+ resolved_path = fullpath;
+ KWSYS_NAMESPACE::SystemTools::ConvertToUnixSlashes(resolved_path);
}
-
- return 0;
}
#else
#include <sys/types.h>
@@ -99,9 +98,20 @@ inline int Chdir(const char* dir)
{
return chdir(dir);
}
-inline char *Realpath(const char *path, char *resolved_path)
+inline void Realpath(const char *path, kwsys_stl::string & resolved_path)
{
- return realpath(path, resolved_path);
+# ifdef MAXPATHLEN
+ char resolved_name[MAXPATHLEN];
+# else
+# ifdef PATH_MAX
+ char resolved_name[PATH_MAX];
+# else
+ char resolved_name[5024];
+# endif //PATH_MAX
+# endif //MAXPATHLEN
+
+ realpath(path, resolved_name);
+ resolved_path = resolved_name;
}
#endif
@@ -1550,23 +1560,12 @@ kwsys_stl::string SystemTools::CollapseFullPath(const char* in_relative,
{
dir = "/";
}
-
-# ifdef MAXPATHLEN
- char resolved_name[MAXPATHLEN];
-# else
-# ifdef PATH_MAX
- char resolved_name[PATH_MAX];
-# else
- char resolved_name[5024];
-# endif //PATH_MAX
-# endif //MAXPATHLEN
-
+
// Resolve relative path.
kwsys_stl::string newDir;
if(!(dir == ""))
{
- Realpath(dir.c_str(), resolved_name);
- newDir = resolved_name;
+ Realpath(dir.c_str(), newDir);
}
else
{