Author Topic: Custom variables - slash in value  (Read 4957 times)

Offline Quiss

  • Multiple posting newcomer
  • *
  • Posts: 76
Custom variables - slash in value
« on: January 27, 2014, 01:37:17 pm »
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)

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Custom variables - slash in value
« Reply #1 on: January 27, 2014, 02:35:15 pm »
Is the problem the same if you use the regular tools menu?

Offline Quiss

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: Custom variables - slash in value
« Reply #2 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.

Offline dmoore

  • Developer
  • Lives here!
  • *****
  • Posts: 1576
Re: Custom variables - slash in value
« Reply #3 on: January 27, 2014, 04:55:50 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.

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?

Offline Quiss

  • Multiple posting newcomer
  • *
  • Posts: 76
Re: Custom variables - slash in value
« Reply #4 on: January 28, 2014, 09:11:27 am »
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):