Author Topic: Slash symbol in custom variable  (Read 5568 times)

Offline Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Slash symbol in custom variable
« on: February 28, 2014, 04:10:54 pm »
I've defined custom variable

REMOTE_DIR=/mnt/app/bin

at Project Build Options->Custom Variables.
But after I closed the project and opened it again, the variable is:

REMOTE_DIR=\mnt\app\bin

So slash become backward slash. Why is it?

I work in Windows 7, Code::Blocks v13.12

Offline Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Slash symbol in custom variable
« Reply #1 on: March 04, 2014, 08:22:36 am »
There is correct record in .cbp project file.

<Environment>
   <Variable name="REMOTE_DIR" value="/mnt/app/bin" />

So the problem is in project file reading (while the project opening).

I need in the variable REMOTE_DIR to specify directory at remote system running on Linux.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Slash symbol in custom variable
« Reply #2 on: March 04, 2014, 09:52:23 am »
C::B does an automatic conversion of paths, so they look native on the different operating systems.
Probably we should add an option to disable this feature for some of the variables.
(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 Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Slash symbol in custom variable
« Reply #3 on: March 05, 2014, 07:26:56 am »
I think you should not do any conversions at all. The variable's value is just text string, and only user must decide is it a path or something else...

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Slash symbol in custom variable
« Reply #4 on: March 05, 2014, 08:40:23 am »
Most of the times the ENV vars are used to setup paths and automatic conversion generally is a good thing. But probably we need some switch to allow the user to override it.
(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 Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Slash symbol in custom variable
« Reply #5 on: March 05, 2014, 11:04:47 am »
May be.
Do the switch, please, because it seems to be very useful.

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Slash symbol in custom variable
« Reply #6 on: March 05, 2014, 11:30:51 pm »
Can you post the envvar tags from your default.conf file, so I can take a look?
The conf file is in %APPDATA%/Codeblocks/default.conf.
The tag to search for is <envvars>.
Copy and paste it here using quote or code tags (# button).
(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 Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Slash symbol in custom variable
« Reply #7 on: March 06, 2014, 07:16:43 am »
%APPDATA%/Codeblocks/default.conf contains global environment, Settings->Environment->Environment Variables. This works fine, there is not incorrect slash modification.

The problem is in Project->Build options->Custom Variable.

It's from project .cbp file(I've deleted extra info about targets Release and Debug):
Code
		<Build>
<Environment>
<Variable name="REMOTE_DIR" value="/mnt/gdb/bin" />
</Environment>
</Build>
Exactly this variable, REMOTE_DIR from Project->Build options->Custom Variable has incorrect behavior.

//---------------------------------------------------------------------------------------------------------
And now from %APPDATA%/Codeblocks/default.conf (but, again, there is not problem):
Code
	<envvars>
<sets>
<default>
<ENVVAR0>
<str>
<![CDATA[1|REMOTE_IP|192.168.1.10]]>
</str>
</ENVVAR0>
<ENVVAR1>
<str>
<![CDATA[1|REMOTE_USER|root]]>
</str>
</ENVVAR1>
<ENVVAR2>
<str>
<![CDATA[1|REMOTE_PASSWORD|root]]>
</str>
</ENVVAR2>
<ENVVAR3>
<str>
<![CDATA[1|REMOTE_DIR|/mnt/app/bin]]>
</str>
</ENVVAR3>
</default>
</sets>
<ACTIVE_SET>
<str>
<![CDATA[default]]>
</str>
</ACTIVE_SET>
<DEBUG_LOG bool="0" />
</envvars>
« Last Edit: March 06, 2014, 07:38:50 am by Dvorkin »

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13406
    • Travis build status
Re: Slash symbol in custom variable
« Reply #8 on: March 07, 2014, 09:14:56 am »
Is it a problem if you start using envvars for this task as a workaround?
The added benefit is that the settings won't be stored in the project, so they can be different for every dev on your team.
(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 Dvorkin

  • Multiple posting newcomer
  • *
  • Posts: 11
Re: Slash symbol in custom variable
« Reply #9 on: March 11, 2014, 05:47:06 am »
Using of the project env vars is not a workaround. The variable REMOTE_DIR is using for copying output file to remote system, and for starting GDB server on remote system. Every project has it's own directory at remote system, so every project has it's own env var REMOTE_DIR. It defined in Project->Build options->Custom Variable.