BUG: fix for bug 6136 make sure includes are not directories
This commit is contained in:
parent
0304073ea6
commit
a5e76555bf
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue