Patch #3500 2013-09-29 18:09

mojca

codesnippets: wrong use of wxStandardPaths & wx 2.9 compat
Download
3500-codesnippets_w.patch (2.6 KB)
Category
Plugin::Bugfix
Status
Rejected
Close date
2013-10-02 17:03
Assigned to
tpetrov
--- src/plugins/contrib/codesnippets/codesnippetsapp.cpp.orig
+++ src/plugins/contrib/codesnippets/codesnippetsapp.cpp
@@ -95,7 +95,11 @@
 END_EVENT_TABLE()
 
 #ifdef __WXMAC__
-    #include "wx/mac/corefoundation/cfstring.h"
+    #if wxCHECK_VERSION(2,9,0)
+        #include "wx/osx/core/cfstring.h"
+    #else
+        #include "wx/mac/corefoundation/cfstring.h"
+    #endif
     #include "wx/intl.h"
 
     #include <CoreFoundation/CFBundle.h>
@@ -112,7 +116,11 @@
         CFRelease(resourcesURL);
         CFStringRef cfStrPath = CFURLCopyFileSystemPath(absoluteURL,kCFURLPOSIXPathStyle);
         CFRelease(absoluteURL);
-        return wxMacCFStringHolder(cfStrPath).AsString(wxLocale::GetSystemEncoding());
+        #if wxCHECK_VERSION(2,9,0)
+          return wxCFStringRef(cfStrPath).AsString(wxLocale::GetSystemEncoding());
+        #else
+          return wxMacCFStringHolder(cfStrPath).AsString(wxLocale::GetSystemEncoding());
+        #endif
     }
 #endif
 
@@ -268,8 +276,6 @@
     m_KeepAliveFileName = wxEmptyString;
     m_pFilesHistory = 0;
 
-    wxStandardPaths stdPaths;
-
     // -------------------------------
     // initialize version and logging
     // -------------------------------
@@ -325,7 +331,7 @@
     // Find Config File
     // -----------------------------------------
     // Create filename like {%HOME%}\codesnippets.ini
-    m_ConfigFolder = Normalize(stdPaths.GetUserDataDir());
+    m_ConfigFolder = Normalize(wxStandardPaths::Get().GetUserDataDir());
     wxString m_ExecuteFolder = Normalize(FindAppPath(wxTheApp->argv[0], ::wxGetCwd(), wxEmptyString));
 
     #if defined(LOGGING)
@@ -1387,8 +1393,6 @@
 void CodeSnippetsAppFrame::ImportCBResources()
 // ----------------------------------------------------------------------------
 {
-    wxStandardPaths stdPaths;
-
     // Location of app config folder
     wxString appConfigFolder =  Normalize(m_ConfigFolder) ;
 
@@ -1399,7 +1403,7 @@
     wxString cbExeFolder = Normalize(GetCBExeFolder());
 
     // location of CodeBlocks config folder
-    wxString cbConfigFolder = Normalize(stdPaths.GetUserDataDir());
+    wxString cbConfigFolder = Normalize(wxStandardPaths::Get().GetUserDataDir());
     wxString appParent = GetConfig()->GetAppParent();
     if ( appParent.empty()) appParent =_T("codeblocks");
     wxString prefixPath;
--- src/plugins/contrib/codesnippets/snippetsconfig.cpp.orig
+++ src/plugins/contrib/codesnippets/snippetsconfig.cpp
@@ -128,8 +128,6 @@
 {
         // file will be saved in $HOME/codesnippets.ini
 
-    wxStandardPaths stdPaths;
-
     #ifdef LOGGING
      wxString fn(__FUNCTION__, wxConvUTF8);
      LOGIT( _T("--- [%s] ---"),fn.c_str() );
mojca 2013-09-29 18:09
mojca 2013-09-29 21:52

I see that patches 3-7 have already been fixed in trunk, but the first two still need to be applied.

mojca 2013-10-01 21:29

This may be closed. Everything is in trunk already.