mirror of
https://github.com/reactos/CMake.git
synced 2025-02-15 17:18:09 +00:00
ENH: Some tweaks, hacks and #ifdefs required to compile
cmake on Borland C++Builder
This commit is contained in:
parent
729908bd4a
commit
46aa080edc
@ -59,7 +59,11 @@ inline const char* Getcwd(char* buf, unsigned int len)
|
||||
}
|
||||
inline int Chdir(const char* dir)
|
||||
{
|
||||
#if defined(__BORLANDC__)
|
||||
return chdir(dir);
|
||||
#else
|
||||
return _chdir(dir);
|
||||
#endif
|
||||
}
|
||||
#else
|
||||
#include <sys/types.h>
|
||||
@ -147,12 +151,21 @@ bool cmSystemTools::MakeDirectory(const char* path)
|
||||
}
|
||||
if(Mkdir(path) != 0)
|
||||
{
|
||||
// There is a bug in the Borland Run time library which makes MKDIR
|
||||
// return EACCES when it should return EEXISTS
|
||||
#ifdef __BORLANDC__
|
||||
if( (errno != EEXIST) && (errno != EACCES) )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
// if it is some other error besides directory exists
|
||||
// then return false
|
||||
if(errno != EEXIST)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -329,7 +342,7 @@ std::string cmSystemTools::Capitalized(const std::string& s)
|
||||
n[i] = tolower(s[i]);
|
||||
}
|
||||
return n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// convert windows slashes to unix slashes \ with /
|
||||
@ -348,8 +361,30 @@ void cmSystemTools::ConvertToUnixSlashes(std::string& path)
|
||||
}
|
||||
}
|
||||
|
||||
// convert windows slashes to unix slashes \ with /
|
||||
void cmSystemTools::CleanUpWindowsSlashes(std::string& path)
|
||||
{
|
||||
std::string::size_type pos = 0;
|
||||
while((pos = path.find('/', pos)) != std::string::npos)
|
||||
{
|
||||
path[pos] = '\\';
|
||||
pos++;
|
||||
}
|
||||
// remove any trailing slash
|
||||
if(path[path.size()-1] == '\\')
|
||||
{
|
||||
path = path.substr(0, path.size()-1);
|
||||
}
|
||||
// remove any duplicate // slashes
|
||||
pos = 0;
|
||||
while((pos = path.find("\\\\", pos)) != std::string::npos)
|
||||
{
|
||||
path.erase(pos, 1);
|
||||
}
|
||||
}
|
||||
|
||||
int cmSystemTools::Grep(const char* dir, const char* file,
|
||||
|
||||
int cmSystemTools::Grep(const char* dir, const char* file,
|
||||
const char* expression)
|
||||
{
|
||||
std::string path = dir;
|
||||
|
@ -88,7 +88,13 @@ public:
|
||||
* Replace Windows file system slashes with Unix-style slashes.
|
||||
*/
|
||||
static void ConvertToUnixSlashes(std::string& path);
|
||||
|
||||
|
||||
/**
|
||||
* Replace Unix file system slashes with Windows-style slashes and
|
||||
* remove any duplicate slashes to clean the path.
|
||||
*/
|
||||
static void CleanUpWindowsSlashes(std::string& path);
|
||||
|
||||
///! Return true if a file exists in the current directory.
|
||||
static bool FileExists(const char* filename);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user