diff --git a/lib/path.cpp b/lib/path.cpp index 5a30aa410..4ef2f43e1 100644 --- a/lib/path.cpp +++ b/lib/path.cpp @@ -140,7 +140,8 @@ std::string Path::getFilenameExtensionInLowerCase(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") { return true; } @@ -160,6 +161,11 @@ bool Path::isCPP(const std::string &path) return true; } + // In unix, ".C" is concidered C++ file + if (getFilenameExtension(path) == ".C") { + return true; + } + return false; } diff --git a/test/testpath.cpp b/test/testpath.cpp index 75f98344c..c80e6ba83 100644 --- a/test/testpath.cpp +++ b/test/testpath.cpp @@ -82,11 +82,16 @@ private: ASSERT(Path::isC("c")==false); ASSERT(Path::isC("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() { 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("C:\\foo\\index.cpp")); ASSERT(Path::isCPP("C:\\foo\\index.Cpp"));