In unix .C is considered C++. Changed isC() and isCPP() to work like they were before refactoring.
This commit is contained in:
parent
36797a97ef
commit
93e3e7361e
|
@ -140,7 +140,8 @@ std::string Path::getFilenameExtensionInLowerCase(const std::string &path)
|
||||||
|
|
||||||
bool Path::isC(const std::string &path)
|
bool Path::isC(const std::string &path)
|
||||||
{
|
{
|
||||||
const std::string extension = getFilenameExtensionInLowerCase(path);
|
// In unix, ".C" is concidered C++ file
|
||||||
|
const std::string extension = getFilenameExtension(path);
|
||||||
if (extension == ".c") {
|
if (extension == ".c") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -160,6 +161,11 @@ bool Path::isCPP(const std::string &path)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// In unix, ".C" is concidered C++ file
|
||||||
|
if (getFilenameExtension(path) == ".C") {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,11 +82,16 @@ private:
|
||||||
ASSERT(Path::isC("c")==false);
|
ASSERT(Path::isC("c")==false);
|
||||||
ASSERT(Path::isC("index.c"));
|
ASSERT(Path::isC("index.c"));
|
||||||
ASSERT(Path::isC("C:\\foo\\index.c"));
|
ASSERT(Path::isC("C:\\foo\\index.c"));
|
||||||
ASSERT(Path::isC("C:\\foo\\index.C"));
|
|
||||||
|
// In unix .C is considered C++
|
||||||
|
ASSERT(Path::isC("C:\\foo\\index.C")==false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void is_cpp() {
|
void is_cpp() {
|
||||||
ASSERT(Path::isCPP("index.c")==false);
|
ASSERT(Path::isCPP("index.c")==false);
|
||||||
|
|
||||||
|
// In unix .C is considered C++
|
||||||
|
ASSERT(Path::isCPP("index.C"));
|
||||||
ASSERT(Path::isCPP("index.cpp"));
|
ASSERT(Path::isCPP("index.cpp"));
|
||||||
ASSERT(Path::isCPP("C:\\foo\\index.cpp"));
|
ASSERT(Path::isCPP("C:\\foo\\index.cpp"));
|
||||||
ASSERT(Path::isCPP("C:\\foo\\index.Cpp"));
|
ASSERT(Path::isCPP("C:\\foo\\index.Cpp"));
|
||||||
|
|
Loading…
Reference in New Issue