Author Topic: Codeblocks portable  (Read 27528 times)

Offline imianz

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Codeblocks portable
« Reply #15 on: October 05, 2011, 02:03:16 pm »
Well, thanks...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Codeblocks portable
« Reply #16 on: October 05, 2011, 02:18:56 pm »
Code
Compiler relative path: $(CODEBLOCKS)\MinGW

This is the problem, the CC doesn't do macro replacements, it seems...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline imianz

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Codeblocks portable
« Reply #17 on: October 05, 2011, 02:27:04 pm »
ok, do you believe that you can fix it?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Codeblocks portable
« Reply #18 on: October 05, 2011, 02:28:45 pm »
Code
Compiler relative path: $(CODEBLOCKS)\MinGW
This is not the log message. :D :D

Quote
This is the problem, the CC doesn't do macro replacements, it seems...
True.

@imianz
You'd better post your log message in the code/quote tab.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 6034
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: Codeblocks portable
« Reply #19 on: October 05, 2011, 03:59:29 pm »
Code
Index: E:/code/cb/cb_trunk/src/plugins/codecompletion/nativeparser.cpp
===================================================================
--- E:/code/cb/cb_trunk/src/plugins/codecompletion/nativeparser.cpp (revision 7475)
+++ E:/code/cb/cb_trunk/src/plugins/codecompletion/nativeparser.cpp (working copy)
@@ -663,7 +663,9 @@
             if (compiler->GetID().Contains(_T("gcc")))
             {
                 wxFileName fn(wxEmptyString, compiler->GetPrograms().CPP);
-                fn.SetPath(compiler->GetMasterPath());
+                wxString masterPath = compiler->GetMasterPath();
+                Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+                fn.SetPath(masterPath);
                 fn.AppendDir(_T("bin"));
                 const wxArrayString& gccDirs = GetGCCCompilerDirs(fn.GetFullPath());
                 TRACE(_T("Adding %d cached gcc dirs to parser..."), gccDirs.GetCount());
@@ -792,7 +794,9 @@
         if (CompilerID.Contains(_T("gcc")))
         {
             wxFileName fn(wxEmptyString, ((Compilers[idxCompiler])->GetPrograms()).CPP);
-            fn.SetPath((Compilers[idxCompiler])->GetMasterPath());
+            wxString masterPath = (Compilers[idxCompiler])->GetMasterPath();
+            Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+            fn.SetPath(masterPath);
             fn.AppendDir(_T("bin"));
             const wxArrayString& gccDirs = GetGCCCompilerDirs(fn.GetFullPath());
             TRACE(_T("Adding %d cached gcc dirs to parser..."), gccDirs.GetCount());
@@ -837,7 +841,9 @@
             return false;
 
         wxFileName fn(wxEmptyString, compiler->GetPrograms().CPP);
-        fn.SetPath(compiler->GetMasterPath());
+        wxString masterPath = compiler->GetMasterPath();
+        Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+        fn.SetPath(masterPath);
         fn.AppendDir(_T("bin"));
 
         static std::map<wxString, wxString> defsMap;
@@ -917,7 +923,10 @@
             Compiler* compiler = CompilerFactory::GetCompiler(compilerId);
             if(!compiler)
                 return false;
-            wxString cmd = compiler->GetMasterPath() + _T("\\bin\\") + compiler->GetPrograms().C;
+
+            wxString masterPath = compiler->GetMasterPath();
+            Manager::Get()->GetMacrosManager()->ReplaceMacros(masterPath);
+            wxString cmd = masterPath + _T("\\bin\\") + compiler->GetPrograms().C;
             Manager::Get()->GetMacrosManager()->ReplaceMacros(cmd);
 
             // wxExecute can be a long action and C::B might have been shutdown in the meantime...
The patch should fix the problem, but do we need to refactor the function body GetMasterPath()?
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline imianz

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Codeblocks portable
« Reply #20 on: October 05, 2011, 11:14:24 pm »
The patch should fix the problem, ....

Yeah! It does.
I can confirm you.
I was too curious to wait for the patch was placed in a nightly build, so I downloaded the source code (7478) and manually applied the patch and build...
Not tested hard, but at first glance seems to work ok.

Post scriptum
The strange thing is the CB splash screen, it show me the revision zero... mah!

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Codeblocks portable
« Reply #21 on: October 05, 2011, 11:16:40 pm »
The strange thing is the CB splash screen, it show me the revision zero... mah!
It is normal, you have to run some script to generate the info...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline Jenna

  • Administrator
  • Lives here!
  • *****
  • Posts: 7252
Re: Codeblocks portable
« Reply #22 on: October 06, 2011, 12:25:14 am »
The strange thing is the CB splash screen, it show me the revision zero... mah!
It is normal, you have to run some script to generate the info...
On windows you need commandline svn in systempath in addition to a gui-client like TortoiseSVN.

Offline imianz

  • Multiple posting newcomer
  • *
  • Posts: 10
Re: Codeblocks portable
« Reply #23 on: October 06, 2011, 07:10:59 pm »
Thank you guys!