Patch #2362 2008-02-05 14:58

pecan

Get lexer sample from user data dir like lexer xml
Download
2362-Get_lexer_samp.patch (1.0 KB)
Category
 
Status
Closed
Close date
2008-04-30 22:22
Assigned to
 
The lexer_{lang}.xml is loaded from the user data dir before the one included with codeblocks. The lexer_{lang}.sample is not. This patch loads the .sample like the .xml

Index: src/sdk/editorcolourset.cpp
===================================================================
--- src/sdk/editorcolourset.cpp    (revision 4831)
+++ src/sdk/editorcolourset.cpp    (working copy)
@@ -789,7 +789,15 @@
         *debugLine = mset.m_DebugLine;
     if (errorLine)
         *errorLine = mset.m_ErrorLine;
-    wxString path = ConfigManager::GetDataFolder() + _T("/lexers/");
+
+    wxString shortname = _T("lexer_") + lang + _T(".sample");
+    // user path first
+    wxString path = ConfigManager::GetFolder(sdDataUser) + _T("/lexers/");
+    wxFileName fullname( path+shortname );
+    if ( not fullname.FileExists(path + shortname) )
+        // global path next
+        path = ConfigManager::GetFolder(sdDataGlobal) + _T("/lexers/");
+
     if (!mset.m_SampleCode.IsEmpty())
         return path + mset.m_SampleCode;
     return wxEmptyString; 
killerbot 2008-04-30 22:22

applied, thanks.