|
|
@@ -263,8 +263,8 @@ void SystemTools::GetPath(kwsys_stl::vector<kwsys_stl::string>& path, const char
|
|
|
}
|
|
|
|
|
|
kwsys_stl::string pathEnv = cpathEnv;
|
|
|
-
|
|
|
- // A hack to make the below algorithm work.
|
|
|
+
|
|
|
+ // A hack to make the below algorithm work.
|
|
|
if(pathEnv[pathEnv.length()-1] != ':')
|
|
|
{
|
|
|
pathEnv += pathSep;
|
|
|
@@ -1473,8 +1473,8 @@ bool SystemTools::FilesDiffer(const char* source,
|
|
|
delete [] dest_buf;
|
|
|
return true;
|
|
|
}
|
|
|
- int ret = memcmp((const void*)source_buf,
|
|
|
- (const void*)dest_buf,
|
|
|
+ int ret = memcmp((const void*)source_buf,
|
|
|
+ (const void*)dest_buf,
|
|
|
statSource.st_size);
|
|
|
|
|
|
delete [] dest_buf;
|
|
|
@@ -1662,23 +1662,22 @@ unsigned long SystemTools::FileLength(const char* filename)
|
|
|
|
|
|
int SystemTools::Strucmp(const char *s1, const char *s2)
|
|
|
{
|
|
|
-// lifted from Graphvis http://www.graphviz.org
|
|
|
- while ((*s1 != '\0')
|
|
|
+ // lifted from Graphvis http://www.graphviz.org
|
|
|
+ while ((*s1 != '\0')
|
|
|
&& (tolower(*s1) == tolower(*s2)))
|
|
|
{
|
|
|
s1++;
|
|
|
s2++;
|
|
|
}
|
|
|
-
|
|
|
- return tolower(*s1) - tolower(*s2);
|
|
|
|
|
|
+ return tolower(*s1) - tolower(*s2);
|
|
|
}
|
|
|
|
|
|
// return file's modified time
|
|
|
long int SystemTools::ModifiedTime(const char* filename)
|
|
|
{
|
|
|
struct stat fs;
|
|
|
- if (stat(filename, &fs) != 0)
|
|
|
+ if (stat(filename, &fs) != 0)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1692,7 +1691,7 @@ long int SystemTools::ModifiedTime(const char* filename)
|
|
|
long int SystemTools::CreationTime(const char* filename)
|
|
|
{
|
|
|
struct stat fs;
|
|
|
- if (stat(filename, &fs) != 0)
|
|
|
+ if (stat(filename, &fs) != 0)
|
|
|
{
|
|
|
return 0;
|
|
|
}
|
|
|
@@ -1714,7 +1713,7 @@ bool SystemTools::ConvertDateMacroString(const char *str, time_t *tmt)
|
|
|
// __DATE__
|
|
|
// The compilation date of the current source file. The date is a string
|
|
|
// literal of the form Mmm dd yyyy. The month name Mmm is the same as for
|
|
|
- // dates generated by the library function asctime declared in TIME.H.
|
|
|
+ // dates generated by the library function asctime declared in TIME.H.
|
|
|
|
|
|
// index: 012345678901
|
|
|
// format: Mmm dd yyyy
|
|
|
@@ -1760,9 +1759,9 @@ bool SystemTools::ConvertTimeStampMacroString(const char *str, time_t *tmt)
|
|
|
struct tm tmt2;
|
|
|
|
|
|
// __TIMESTAMP__
|
|
|
- // The date and time of the last modification of the current source file,
|
|
|
- // expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy,
|
|
|
- /// where Ddd is the abbreviated day of the week and Date is an integer
|
|
|
+ // The date and time of the last modification of the current source file,
|
|
|
+ // expressed as a string literal in the form Ddd Mmm Date hh:mm:ss yyyy,
|
|
|
+ /// where Ddd is the abbreviated day of the week and Date is an integer
|
|
|
// from 1 to 31.
|
|
|
|
|
|
// index: 0123456789
|
|
|
@@ -1878,11 +1877,11 @@ size_t SystemTools::GetMaximumFilePathLength()
|
|
|
* found. Otherwise, the empty string is returned.
|
|
|
*/
|
|
|
kwsys_stl::string SystemTools
|
|
|
-::FindFile(const char* name,
|
|
|
+::FindFile(const char* name,
|
|
|
const kwsys_stl::vector<kwsys_stl::string>& userPaths)
|
|
|
{
|
|
|
// Add the system search path to our path first
|
|
|
- kwsys_stl::vector<kwsys_stl::string> path;
|
|
|
+ kwsys_stl::vector<kwsys_stl::string> path;
|
|
|
SystemTools::GetPath(path, "CMAKE_FILE_PATH");
|
|
|
SystemTools::GetPath(path);
|
|
|
// now add the additional paths
|
|
|
@@ -1957,7 +1956,7 @@ kwsys_stl::string SystemTools::FindProgram(
|
|
|
{
|
|
|
SystemTools::GetPath(path);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// now add the additional paths
|
|
|
for(kwsys_stl::vector<kwsys_stl::string>::const_iterator i = userPaths.begin();
|
|
|
i != userPaths.end(); ++i)
|
|
|
@@ -2024,8 +2023,8 @@ kwsys_stl::string SystemTools::FindProgram(
|
|
|
it != names.end() ; ++it)
|
|
|
{
|
|
|
// Try to find the program.
|
|
|
- kwsys_stl::string result = SystemTools::FindProgram(it->c_str(),
|
|
|
- path,
|
|
|
+ kwsys_stl::string result = SystemTools::FindProgram(it->c_str(),
|
|
|
+ path,
|
|
|
noSystemPath);
|
|
|
if ( !result.empty() )
|
|
|
{
|
|
|
@@ -2050,7 +2049,7 @@ kwsys_stl::string SystemTools
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(name);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Add the system search path to our path.
|
|
|
kwsys_stl::vector<kwsys_stl::string> path;
|
|
|
SystemTools::GetPath(path);
|
|
|
@@ -2080,7 +2079,7 @@ kwsys_stl::string SystemTools
|
|
|
tryPath += "/";
|
|
|
tryPath += name;
|
|
|
tryPath += ".lib";
|
|
|
- if(SystemTools::FileExists(tryPath.c_str())
|
|
|
+ if(SystemTools::FileExists(tryPath.c_str())
|
|
|
&& !SystemTools::FileIsDirectory(tryPath.c_str()))
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(tryPath.c_str());
|
|
|
@@ -2090,7 +2089,7 @@ kwsys_stl::string SystemTools
|
|
|
tryPath += "/lib";
|
|
|
tryPath += name;
|
|
|
tryPath += ".so";
|
|
|
- if(SystemTools::FileExists(tryPath.c_str())
|
|
|
+ if(SystemTools::FileExists(tryPath.c_str())
|
|
|
&& !SystemTools::FileIsDirectory(tryPath.c_str()))
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(tryPath.c_str());
|
|
|
@@ -2099,7 +2098,7 @@ kwsys_stl::string SystemTools
|
|
|
tryPath += "/lib";
|
|
|
tryPath += name;
|
|
|
tryPath += ".a";
|
|
|
- if(SystemTools::FileExists(tryPath.c_str())
|
|
|
+ if(SystemTools::FileExists(tryPath.c_str())
|
|
|
&& !SystemTools::FileIsDirectory(tryPath.c_str()))
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(tryPath.c_str());
|
|
|
@@ -2108,7 +2107,7 @@ kwsys_stl::string SystemTools
|
|
|
tryPath += "/lib";
|
|
|
tryPath += name;
|
|
|
tryPath += ".sl";
|
|
|
- if(SystemTools::FileExists(tryPath.c_str())
|
|
|
+ if(SystemTools::FileExists(tryPath.c_str())
|
|
|
&& !SystemTools::FileIsDirectory(tryPath.c_str()))
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(tryPath.c_str());
|
|
|
@@ -2117,7 +2116,7 @@ kwsys_stl::string SystemTools
|
|
|
tryPath += "/lib";
|
|
|
tryPath += name;
|
|
|
tryPath += ".dylib";
|
|
|
- if(SystemTools::FileExists(tryPath.c_str())
|
|
|
+ if(SystemTools::FileExists(tryPath.c_str())
|
|
|
&& !SystemTools::FileIsDirectory(tryPath.c_str()))
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(tryPath.c_str());
|
|
|
@@ -2126,20 +2125,20 @@ kwsys_stl::string SystemTools
|
|
|
tryPath += "/lib";
|
|
|
tryPath += name;
|
|
|
tryPath += ".dll";
|
|
|
- if(SystemTools::FileExists(tryPath.c_str())
|
|
|
+ if(SystemTools::FileExists(tryPath.c_str())
|
|
|
&& !SystemTools::FileIsDirectory(tryPath.c_str()))
|
|
|
{
|
|
|
return SystemTools::CollapseFullPath(tryPath.c_str());
|
|
|
}
|
|
|
#endif
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// Couldn't find the library.
|
|
|
return "";
|
|
|
}
|
|
|
|
|
|
bool SystemTools::FileIsDirectory(const char* name)
|
|
|
-{
|
|
|
+{
|
|
|
struct stat fs;
|
|
|
if(stat(name, &fs) == 0)
|
|
|
{
|
|
|
@@ -2156,7 +2155,7 @@ bool SystemTools::FileIsDirectory(const char* name)
|
|
|
}
|
|
|
|
|
|
bool SystemTools::FileIsSymlink(const char* name)
|
|
|
-{
|
|
|
+{
|
|
|
#if _WIN32
|
|
|
(void)name;
|
|
|
return false;
|
|
|
@@ -2209,7 +2208,7 @@ bool SystemTools::SplitProgramPath(const char* in_name,
|
|
|
dir = in_name;
|
|
|
file = "";
|
|
|
SystemTools::ConvertToUnixSlashes(dir);
|
|
|
-
|
|
|
+
|
|
|
if(!SystemTools::FileIsDirectory(dir.c_str()))
|
|
|
{
|
|
|
kwsys_stl::string::size_type slashPos = dir.rfind("/");
|
|
|
@@ -2234,11 +2233,11 @@ bool SystemTools::SplitProgramPath(const char* in_name,
|
|
|
return true;
|
|
|
}
|
|
|
|
|
|
-bool SystemTools::FindProgramPath(const char* argv0,
|
|
|
+bool SystemTools::FindProgramPath(const char* argv0,
|
|
|
kwsys_stl::string& pathOut,
|
|
|
kwsys_stl::string& errorMsg,
|
|
|
const char* exeName,
|
|
|
- const char* buildDir,
|
|
|
+ const char* buildDir,
|
|
|
const char* installPrefix )
|
|
|
{
|
|
|
kwsys_stl::vector<kwsys_stl::string> failures;
|
|
|
@@ -2308,13 +2307,13 @@ void SystemTools::AddTranslationPath(const char * a, const char * b)
|
|
|
if( SystemTools::FileIsDirectory( path_a.c_str() ) )
|
|
|
{
|
|
|
// Make sure the path is a full path and does not contain no '..'
|
|
|
- if( SystemTools::FileIsFullPath(path_b.c_str()) && path_b.find("..")
|
|
|
+ if( SystemTools::FileIsFullPath(path_b.c_str()) && path_b.find("..")
|
|
|
== kwsys_stl::string::npos )
|
|
|
{
|
|
|
// Before inserting make sure path ends with '/'
|
|
|
if(path_a.size() && path_a[path_a.size() -1] != '/')
|
|
|
{
|
|
|
- path_a += '/';
|
|
|
+ path_a += '/';
|
|
|
}
|
|
|
if(path_b.size() && path_b[path_b.size() -1] != '/')
|
|
|
{
|
|
|
@@ -2460,7 +2459,7 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
|
|
|
{
|
|
|
return "";
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
// split up both paths into arrays of strings using / as a separator
|
|
|
kwsys_stl::vector<kwsys::String> localSplit = SystemTools::SplitString(local, '/', true);
|
|
|
kwsys_stl::vector<kwsys::String> remoteSplit = SystemTools::SplitString(remote, '/', true);
|
|
|
@@ -2470,8 +2469,8 @@ kwsys_stl::string SystemTools::RelativePath(const char* local, const char* remot
|
|
|
unsigned int sameCount = 0;
|
|
|
while(
|
|
|
((sameCount <= (localSplit.size()-1)) && (sameCount <= (remoteSplit.size()-1)))
|
|
|
- &&
|
|
|
-// for windows and apple do a case insensitive string compare
|
|
|
+ &&
|
|
|
+// for windows and apple do a case insensitive string compare
|
|
|
#if defined(_WIN32) || defined(__APPLE__)
|
|
|
SystemTools::Strucmp(localSplit[sameCount].c_str(),
|
|
|
remoteSplit[sameCount].c_str()) == 0
|