Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: tiwag on June 25, 2007, 06:34:22 pm

Title: PATH problem on windows with CB rev 4170
Post by: tiwag on June 25, 2007, 06:34:22 pm
on windows platform the PATH environment variable is set to
Quote
.;$PATH

$PATH doesn't get expanded

the following program

Code
#include <windows.h>
#include <stdio.h>

int main(void) {

  printf("%s",getenv("path"));

  return 0;
}


run with CB 4172 returns
Quote
.;$PATH
Process returned 0 (0x0)   execution time : 0.015 s
Press any key to continue.

 8)
Title: Re: PATH problem on windows with CB rev 4170
Post by: mandrav on June 25, 2007, 06:58:41 pm
Thanks for pointing this out. Fixing it now...

Although I can't test the fix atm, I 've committed it and it should work again now.
Title: Re: PATH problem on windows with CB rev 4170
Post by: tiwag on June 26, 2007, 03:35:59 am
sorry but it doesn't

now the path variable is set to
Quote
.;%PATH%

but the original setting is still lost
Title: Re: PATH problem on windows with CB rev 4170
Post by: tiwag on June 26, 2007, 04:38:26 am
it works fine with the following patch

Code
Index: compilergcc.cpp
===================================================================
--- compilergcc.cpp (revision 4175)
+++ compilergcc.cpp (working copy)
@@ -96,13 +96,10 @@
 
 #if defined(__APPLE__) && defined(__MACH__)
     #define LIBRARY_ENVVAR _T("DYLD_LIBRARY_PATH")
-    #define LIBRARY_ENVVAR_DOLLAR _T("$") LIBRARY_ENVVAR
 #elif !defined(__WXMSW__)
     #define LIBRARY_ENVVAR _T("LD_LIBRARY_PATH")
-    #define LIBRARY_ENVVAR_DOLLAR _T("$") LIBRARY_ENVVAR
 #else
     #define LIBRARY_ENVVAR _T("PATH")
-    #define LIBRARY_ENVVAR_DOLLAR _T("%") LIBRARY_ENVVAR _T("%")
 #endif
 
 namespace
@@ -1188,7 +1185,7 @@
  newLibPath << GetStringFromArray(compiler->GetLinkerSearchDirs(cmd->target), libPathSep);
  if (newLibPath.SubString(newLibPath.Length() - 1, 1) != libPathSep)
  newLibPath << libPathSep;
- newLibPath << LIBRARY_ENVVAR_DOLLAR;
+ newLibPath << oldLibPath;
  wxSetEnv(LIBRARY_ENVVAR, newLibPath);
 // LogMessage(_T("LIBRARY_ENVVAR=") + newLibPath, cltInfo);
  }

and i guess it will work fine in linux and mac too,
but i can test it only on windows atm.

brgds tiwag
Title: Re: PATH problem on windows with CB rev 4170
Post by: mandrav on June 26, 2007, 09:58:07 am
Thanks tiwag.
Title: Re: PATH problem on windows with CB rev 4170
Post by: tiwag on June 26, 2007, 03:21:04 pm
as usual M$ windoze needs extra treatment for pathes with spaces  :(

fixed in rev 4184