Patch #2865 2009-12-20 18:57

techy

Categorize source files regardless of their capitalization
Download
2865-Categorize_sou.patch (1.8 KB)
Category
Application::Refinement
Status
Accepted
Close date
2010-02-03 17:44
Assigned to
mortenmacfly
Index: src/sdk/filegroupsandmasks.cpp
===================================================================
--- src/sdk/filegroupsandmasks.cpp    (revision 5986)
+++ src/sdk/filegroupsandmasks.cpp    (working copy)
@@ -64,21 +64,21 @@
 
     // only add default groups if none were loaded...
     unsigned int group = AddGroup(_("Sources"));
-    SetFileMasks(group, _T("*.c;*.cpp;*.cc;*.cxx;*.C;*.CPP;*.CC;*.CXX") );
+    SetFileMasks(group, _T("*.c;*.cpp;*.cc;*.cxx") );
     group = AddGroup(_("D Sources"));
-    SetFileMasks(group, _T("*.d;*.D") );
+    SetFileMasks(group, _T("*.d") );
     group = AddGroup(_("Fortran Sources"));
-    SetFileMasks(group, _T("*.f;*.f77;*.f90;*.f95;*.F;*.F77;*.F90;*.F95") );
+    SetFileMasks(group, _T("*.f;*.f77;*.f90;*.f95") );
     group = AddGroup(_("Java Sources"));
-    SetFileMasks(group, _T("*.java;*.JAVA") );
+    SetFileMasks(group, _T("*.java") );
     group = AddGroup(_("Headers"));
-    SetFileMasks(group, _T("*.h;*.hpp;*.hh;*.hxx;*.H;*.HPP;*.HH;*.HXX") );
+    SetFileMasks(group, _T("*.h;*.hpp;*.hh;*.hxx") );
     group = AddGroup(_("ASM Sources"));
-    SetFileMasks(group, _T("*.asm;*.ASM;*.s;*.S;*.ss;*.SS;*.s62;*.S62") );
+    SetFileMasks(group, _T("*.asm;*.s;*.ss;*.s62") );
     group = AddGroup(_("Resources"));
-    SetFileMasks(group, _T("*.res;*.xrc;*.rc;*.RES;*.XRC;*.RC") );
+    SetFileMasks(group, _T("*.res;*.xrc;*.rc") );
     group = AddGroup(_("Scripts"));
-    SetFileMasks(group, _T("*.script;*.SCRIPT") );
+    SetFileMasks(group, _T("*.script") );
 }
 
 void FilesGroupsAndMasks::Load()
@@ -186,7 +186,7 @@
     const FileGroups* fg = m_Groups[group];
     for (unsigned int i = 0; i < fg->fileMasks.GetCount(); ++i)
     {
-        if (ext.Matches(fg->fileMasks[i]))
+        if (ext.Lower().Matches(fg->fileMasks[i].Lower()))
             return true;
     }
     return false;
techy 2009-12-20 19:06

Right now you have to set all combinations of extension capitalisation in order to have a source file categorized. For instance, for c++ sources you have to set *.cpp, *.CPP, which are the default ones, but this does not recognise for instance *.Cpp. This patch simplifies this by converting the input file and the extension to lowercase before match test is made so all combinations of uppercases and lowercases will be treated the same way.

Note that this patch should be applied together with the header/source swapping patch (the last or the previous version, but not the original patch), otherwise header/source swapping might not work correctly.