News:

The new Release 25.03 is out! You can download binaries for Windows and many major Linux distros here .

Main Menu

Using EnvVar

Started by ironhead, June 30, 2010, 03:36:20 PM

Previous topic - Next topic

ironhead

I've set the PATH environment to 'PATH=%PATH%;C:\NewPath' variable via 'Settings > Environment > Environment Variables' which as I understand it should set the variable on startup.  However, when I close C::B and restart it, the PATH variable is not updated (i.e. C:\NewPath is not in %PATH%).  Is there something I have to do to have these environment variables set on startup?

stahta01

Quote from: ironhead on June 30, 2010, 03:36:20 PM
I've set the PATH environment to 'PATH=%PATH%;C:\NewPath' variable via 'Settings > Environment > Environment Variables' which as I understand it should set the variable on startup.  However, when I close C::B and restart it, the PATH variable is not updated (i.e. C:\NewPath is not in %PATH%).  Is there something I have to do to have these environment variables set on startup?

The EnvVar plugin is for changing the Environment Variables for just inside Code::Blocks; if you want the changes to be permanent change them the normal way for the OS. Note, most commands ran from Code::Blocks should also see the modified Environment Variables.

Tim S.

C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

ironhead

Quote from: stahta01 on June 30, 2010, 04:24:33 PMThe EnvVar plugin is for changing the Environment Variables for just inside Code::Blocks; if you want the changes to be permanent change them the normal way for the OS. Note, most commands ran from Code::Blocks should also see the modified Environment Variables.

Agreed.  I need PATH to be temporarily modified when running a pre-build command, and I would like to not have to modify the system PATH.  My expectations would be that if the PATH variable is set on C::B startup, the modified PATH should be used for the pre-build command and not affect applications run outside of C::B.

stahta01

The Devs are going to need more info; OS Version CB Version etc.
This assumes they think it is a problem.

If you get no fix in a week; post the bug in the correct site.

Tim S.
C Programmer working to learn more about C++.
On Windows 10 64 bit and Windows 11 64 bit.
--
When in doubt, read the CB WiKi FAQ. [url="http://wiki.codeblocks.org"]http://wiki.codeblocks.org[/url]

ironhead

I'm running XP SP3 with C::B 10.05.

oBFusCATed

Also a simple test project that reproduces the problem or at least the full build log.
(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!]

ironhead

Quote from: oBFusCATed on June 30, 2010, 09:32:23 PM
Also a simple test project that reproduces the problem or at least the full build log.

Erm.... the build log doesn't show much (I have Compiler Logging set to 'Full Command Line') all I see is:

Running project pre-build steps

My pre-build step is:

[[ local hgfile = _T("hgversion.h"); local hgcmd = _T("cmd /c hg summary | grep parent | sed -f hgversion.sed > hgversion.h"); if ( !IO.FileExists(hgfile) ) { IO.Execute(hgcmd); } ]]

the problem is that grep and sed are in my MSYS directory, which I temporarily want to add to the PATH for this pre-build step.  If I add the MSYS path to the PATH prior to starting C::B, the command works fine.

ironhead

I've managed to work around the issue by adding my MSYS path to the 'Additional Paths' tabs in 'Settings > Compiler and Debugger > Global Compiler Settings' under the 'Toolchain executables' tab.