summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2005-10-12 16:08:49 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2005-10-12 16:08:49 (GMT)
commitb93359f41d50a86c3ab91733f8f4069e3bb1e158 (patch)
tree8a6cfdb8572d05c598b927e7a778a5520dfd21f4 /Source
parent18e14ba2af9a5c2065a2683832d173343be96240 (diff)
downloadCMake-b93359f41d50a86c3ab91733f8f4069e3bb1e158.zip
CMake-b93359f41d50a86c3ab91733f8f4069e3bb1e158.tar.gz
CMake-b93359f41d50a86c3ab91733f8f4069e3bb1e158.tar.bz2
ENH: Add an accessor for the maximum file length
Diffstat (limited to 'Source')
-rw-r--r--Source/kwsys/SystemTools.cxx30
-rw-r--r--Source/kwsys/SystemTools.hxx.in5
2 files changed, 26 insertions, 9 deletions
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index f6aafc9..ae3154a 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -89,6 +89,18 @@ public:
#include <io.h>
#include <direct.h>
#define _unlink unlink
+#endif
+
+/* The maximum length of a file name. */
+#if defined(PATH_MAX)
+# define KWSYS_SYSTEMTOOLS_MAXPATH PATH_MAX
+#elif defined(MAXPATHLEN)
+# define KWSYS_SYSTEMTOOLS_MAXPATH MAXPATHLEN
+#else
+# define KWSYS_SYSTEMTOOLS_MAXPATH 16384
+#endif
+
+#if defined(_WIN32) && (defined(_MSC_VER) || defined(__BORLANDC__) || defined(__MINGW32__))
inline int Mkdir(const char* dir)
{
return _mkdir(dir);
@@ -141,15 +153,7 @@ inline int Chdir(const char* dir)
}
inline void Realpath(const char *path, kwsys_stl::string & 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
+ char resolved_name[KWSYS_SYSTEMTOOLS_MAXPATH];
realpath(path, resolved_name);
resolved_path = resolved_name;
@@ -196,6 +200,7 @@ class SystemToolsTranslationMap :
{
};
+
double
SystemTools::GetTime(void)
{
@@ -1849,6 +1854,13 @@ bool SystemTools::RemoveADirectory(const char* source)
}
/**
+ */
+size_t SystemTools::GetMaximumFilePathLength()
+{
+ return KWSYS_SYSTEMTOOLS_MAXPATH;
+}
+
+/**
* Find the file the given name. Searches the given path and then
* the system search path. Returns the full path to the file if it is
* found. Otherwise, the empty string is returned.
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 31beafc..39b5234 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -473,6 +473,11 @@ public:
static bool RemoveADirectory(const char* source);
/**
+ * Get the maximum full file path length
+ */
+ static size_t GetMaximumFilePathLength();
+
+ /**
* Find a file in the system PATH, with optional extra paths
*/
static kwsys_stl::string FindFile(