In unix .C is considered C++. Changed isC() and isCPP() to work like they were before refactoring.

This commit is contained in:
Reijo Tomperi 2012-01-07 10:47:15 +02:00
parent 36797a97ef
commit 93e3e7361e
2 changed files with 13 additions and 2 deletions

View File

@ -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;
} }

View File

@ -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"));