From 3ead61589f4a44f5f4697443c2b1428391b7ff7a Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Fri, 31 Mar 2017 09:55:45 -0400 Subject: [PATCH] SystemTools: Fix stat() wrapper compilation with Borland --- SystemTools.cxx | 7 ++++++- SystemTools.hxx.in | 4 ++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/SystemTools.cxx b/SystemTools.cxx index 3b651856..100a49ce 100644 --- a/SystemTools.cxx +++ b/SystemTools.cxx @@ -1277,7 +1277,12 @@ int SystemTools::Stat(const std::string& path, SystemTools::Stat_t* buf) // Ideally we should use ConvertToWindowsExtendedPath to support // long paths, but _wstat64 rejects paths with '?' in them, thinking // they are wildcards. - return _wstat64(Encoding::ToWide(path).c_str(), buf); + std::wstring const& wpath = Encoding::ToWide(path); +#if defined(__BORLANDC__) + return _wstati64(wpath.c_str(), buf); +#else + return _wstat64(wpath.c_str(), buf); +#endif #else return stat(path.c_str(), buf); #endif diff --git a/SystemTools.hxx.in b/SystemTools.hxx.in index bfd979d2..53abce7a 100644 --- a/SystemTools.hxx.in +++ b/SystemTools.hxx.in @@ -331,7 +331,11 @@ public: * 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 -- GitLab