summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Source/cmDependsC.cxx6
-rw-r--r--Source/cmDependsFortran.cxx12
-rw-r--r--Source/cmMakeDepend.cxx8
-rw-r--r--Source/kwsys/SystemTools.cxx8
-rw-r--r--Source/kwsys/SystemTools.hxx.in7
5 files changed, 25 insertions, 16 deletions
diff --git a/Source/cmDependsC.cxx b/Source/cmDependsC.cxx
index 16faf37..5ac98bb 100644
--- a/Source/cmDependsC.cxx
+++ b/Source/cmDependsC.cxx
@@ -113,13 +113,13 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
std::string fullName;
if(first || cmSystemTools::FileIsFullPath(current.FileName.c_str()))
{
- if(cmSystemTools::FileExists(current.FileName.c_str()))
+ if(cmSystemTools::FileExists(current.FileName.c_str(), true))
{
fullName = current.FileName;
}
}
else if(!current.QuotedLocation.empty() &&
- cmSystemTools::FileExists(current.QuotedLocation.c_str()))
+ cmSystemTools::FileExists(current.QuotedLocation.c_str(), true))
{
// The include statement producing this entry was a double-quote
// include and the included file is present in the directory of
@@ -167,7 +167,7 @@ bool cmDependsC::WriteDependencies(const char *src, const char *obj,
}
// Look for the file in this location.
- if(cmSystemTools::FileExists(tempPathStr.c_str()))
+ if(cmSystemTools::FileExists(tempPathStr.c_str(), true))
{
fullName = tempPathStr;
HeaderLocationCache[cacheKey]=fullName;
diff --git a/Source/cmDependsFortran.cxx b/Source/cmDependsFortran.cxx
index 7d980fe..e4037bf 100644
--- a/Source/cmDependsFortran.cxx
+++ b/Source/cmDependsFortran.cxx
@@ -174,7 +174,7 @@ bool cmDependsFortran::WriteDependencies(const char *src, const char *obj,
fullPath += "/";
fullPath += m;
fullPath += ".mod.stamp";
- if(!cmSystemTools::FileExists(fullPath.c_str()))
+ if(!cmSystemTools::FileExists(fullPath.c_str(), true))
{
std::ofstream dummy(fullPath.c_str());
dummy
@@ -303,7 +303,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
mod_upper += ".mod";
mod_lower += ".mod";
- if(cmSystemTools::FileExists(mod_upper.c_str()))
+ if(cmSystemTools::FileExists(mod_upper.c_str(), true))
{
if(!cmSystemTools::CopyFileIfDifferent(mod_upper.c_str(), stamp.c_str()))
{
@@ -314,7 +314,7 @@ bool cmDependsFortran::CopyModule(const std::vector<std::string>& args)
}
return true;
}
- else if(cmSystemTools::FileExists(mod_lower.c_str()))
+ else if(cmSystemTools::FileExists(mod_lower.c_str(), true))
{
if(!cmSystemTools::CopyFileIfDifferent(mod_lower.c_str(), stamp.c_str()))
{
@@ -341,7 +341,7 @@ bool cmDependsFortran::FindIncludeFile(const char* dir,
if(cmSystemTools::FileIsFullPath(includeName))
{
fileName = includeName;
- return cmSystemTools::FileExists(fileName.c_str());
+ return cmSystemTools::FileExists(fileName.c_str(), true);
}
else
{
@@ -350,7 +350,7 @@ bool cmDependsFortran::FindIncludeFile(const char* dir,
std::string fullName = dir;
fullName += "/";
fullName += includeName;
- if(cmSystemTools::FileExists(fullName.c_str()))
+ if(cmSystemTools::FileExists(fullName.c_str(), true))
{
fileName = fullName;
return true;
@@ -363,7 +363,7 @@ bool cmDependsFortran::FindIncludeFile(const char* dir,
fullName = *i;
fullName += "/";
fullName += includeName;
- if(cmSystemTools::FileExists(fullName.c_str()))
+ if(cmSystemTools::FileExists(fullName.c_str(), true))
{
fileName = fullName;
return true;
diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx
index d0e0827..61cb443 100644
--- a/Source/cmMakeDepend.cxx
+++ b/Source/cmMakeDepend.cxx
@@ -103,7 +103,7 @@ void cmMakeDepend::GenerateDependInformation(cmDependInformation* info)
bool found = false;
// If the file exists, use it to find dependency information.
- if(cmSystemTools::FileExists(path))
+ if(cmSystemTools::FileExists(path, true))
{
// Use the real file to find its dependencies.
this->DependWalk(info);
@@ -311,7 +311,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
}
}
- if(cmSystemTools::FileExists(fname))
+ if(cmSystemTools::FileExists(fname, true))
{
std::string fp = cmSystemTools::CollapseFullPath(fname);
this->DirectoryToFileToPathMap[extraPath? extraPath: ""][fname] = fp;
@@ -327,7 +327,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
path = path + "/";
}
path = path + fname;
- if(cmSystemTools::FileExists(path.c_str())
+ if(cmSystemTools::FileExists(path.c_str(), true)
&& !cmSystemTools::FileIsDirectory(path.c_str()))
{
std::string fp = cmSystemTools::CollapseFullPath(path.c_str());
@@ -344,7 +344,7 @@ std::string cmMakeDepend::FullPath(const char* fname, const char *extraPath)
path = path + "/";
}
path = path + fname;
- if(cmSystemTools::FileExists(path.c_str())
+ if(cmSystemTools::FileExists(path.c_str(), true)
&& !cmSystemTools::FileIsDirectory(path.c_str()))
{
std::string fp = cmSystemTools::CollapseFullPath(path.c_str());
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 1248f29..977133f 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -821,7 +821,7 @@ bool SystemTools::SameFile(const char* file1, const char* file2)
// return true if the file exists
-bool SystemTools::FileExists(const char* filename)
+bool SystemTools::FileExists(const char* filename, bool isFile)
{
#ifdef _MSC_VER
# define access _access
@@ -843,6 +843,12 @@ bool SystemTools::FileExists(const char* filename)
}
else
{
+ // If isFile is set return not FileIsDirectory,
+ // so this will only be true if it is a file
+ if(isFile)
+ {
+ return !SystemTools::FileIsDirectory(filename);
+ }
return true;
}
}
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in
index 568643b..4845851 100644
--- a/Source/kwsys/SystemTools.hxx.in
+++ b/Source/kwsys/SystemTools.hxx.in
@@ -270,9 +270,12 @@ public:
static kwsys_stl::string ConvertToWindowsOutputPath(const char*);
/**
- * Return true if a file exists in the current directory
+ * Return true if a file exists in the current directory.
+ * If isFile = true, then make sure the file is a file and
+ * not a directory. If isFile = false, then return true
+ * if it is a file or a directory.
*/
- static bool FileExists(const char* filename);
+ static bool FileExists(const char* filename, bool isFile=false);
/**
* Return file length