diff options
author | KWSys Upstream <kwrobot@kitware.com> | 2017-04-12 13:08:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-04-12 13:10:22 (GMT) |
commit | 85841e8bd5e678f69271272db7f838f873347812 (patch) | |
tree | eb74d111e23c0b680a97ddb0a24d475983826100 /SystemTools.hxx.in | |
parent | e9c5505bf9c51c34dea703b86a293ff04475db54 (diff) | |
download | CMake-85841e8bd5e678f69271272db7f838f873347812.zip CMake-85841e8bd5e678f69271272db7f838f873347812.tar.gz CMake-85841e8bd5e678f69271272db7f838f873347812.tar.bz2 |
KWSys 2017-04-12 (23a4c211)
Code extracted from:
https://gitlab.kitware.com/utils/kwsys.git
at commit 23a4c211e90c1cfd399c3632141dbd549a5db8cf (master).
Upstream Shortlog
-----------------
Brad King (2):
41a9dfef SystemInformation: Fix dynamic loader failure on WinXP SP2
3ead6158 SystemTools: Fix stat() wrapper compilation with Borland
Daniel Pfeifer (1):
ce5b0d34 Disable include-what-you-use
Mathieu Westphal (1):
a2bf6bb3 SystemTools: Add cross-platform stat() wrapper
Diffstat (limited to 'SystemTools.hxx.in')
-rw-r--r-- | SystemTools.hxx.in | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index 7a5256b..53abce7 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -13,6 +13,9 @@ #include <@KWSYS_NAMESPACE@/String.hxx> #include <sys/types.h> +// include sys/stat.h after sys/types.h +#include <sys/stat.h> + #if !defined(_WIN32) || defined(__CYGWIN__) #include <unistd.h> // For access permissions for use with access() #endif @@ -324,6 +327,27 @@ public: TestFilePermissions permissions); static bool TestFileAccess(const std::string& filename, TestFilePermissions permissions); +/** + * Cross platform wrapper for stat struct + */ +#if defined(_WIN32) && !defined(__CYGWIN__) +#if defined(__BORLANDC__) + typedef struct stati64 Stat_t; +#else + typedef struct _stat64 Stat_t; +#endif +#else + typedef struct stat Stat_t; +#endif + + /** + * Cross platform wrapper for stat system call + * + * On Windows this may not work for paths longer than 250 characters + * due to limitations of the underlying '_wstat64' call. + */ + static int Stat(const char* path, Stat_t* buf); + static int Stat(const std::string& path, Stat_t* buf); /** * Converts Cygwin path to Win32 path. Uses dictionary container for |