User forums > Help

Custom variables - slash in value

(1/1)

Quiss:
Hi,

In Project build options->Custom  variables, I add device=LPC11C24/301 variable in order to use in a command line argument as "C:\Program Files (x86)\SEGGER\JLinkARM_V480\JLinkGDBServerCL.exe -select USB -device $device -if SWD -speed auto -endian little" with Tools+. It's working as expected but when I reopen the project, custom variable changes to device=LPC11C24\301. Is there something I can do that the slash in value not to be changed to backslash?

rev 9605, Windows 8 (It's also same in 13.12)

dmoore:
Is the problem the same if you use the regular tools menu?

Quiss:
Actually, problem is that the variable I defined in "Project build options->Custom  variables" changes (slash to backslash) whenever I close and reopen Codeblocks whether I'm using Tools+ or not.

dmoore:

--- Quote from: Quiss on January 27, 2014, 03:29:07 pm ---Actually, problem is that the variable I defined in "Project build options->Custom  variables" changes (slash to backslash) whenever I close and reopen Codeblocks whether I'm using Tools+ or not.

--- End quote ---

Just wanted to make sure the problem isn't Tools+ related. Sounds like overzealous separator conversion when the project file is saved/loaded. It's might be possible to escape the character to prevent this, though I'm not exactly sure how. (maybe try enclosing the definition in quotes?)

You could also try defining device as a global variable (settings -> global variables, then use $(#device) in the commnad line), but maybe this is something you want to define in your project only?

Quiss:
Yes, I want to define it per project but I can live with defining it in one place. I tried enclosing it quotes, adding backslash, double slashes with no luck.

As you suggested, I also tried to use "global variables". Unfortunately, when I use it with $(#device) in Tools+ or as a compiler flag, it automatically changes slash to backslash again (although in  "global variable editor", looks like still with slash):

Navigation

[0] Message Index

Go to full version