From 93e3e7361ee8048a8c06198908dfd98ef1a3d5a7 Mon Sep 17 00:00:00 2001 From: Reijo Tomperi Date: Sat, 7 Jan 2012 10:47:15 +0200 Subject: [PATCH] In unix .C is considered C++. Changed isC() and isCPP() to work like they were before refactoring. --- lib/path.cpp | 8 +++++++- test/testpath.cpp | 7 ++++++- 2 files changed, 13 insertions(+), 2 deletions(-) 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"));