Author Topic: Add file to project that are located in path in global variable [?]  (Read 2324 times)

Offline Totoxa

  • Multiple posting newcomer
  • *
  • Posts: 31
Could I add files to a project (to compile and link) that are located in path in global variable?

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Add file to project that are located in path in global variable [?]
« Reply #1 on: January 06, 2014, 09:02:33 am »
Could I add files to a project (to compile and link) that are located in path in global variable?
The PATH envvar is used by command line processors to find executable and libraries, not general (text) files. It woudn't make sense, really.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline Totoxa

  • Multiple posting newcomer
  • *
  • Posts: 31
Re: Add file to project that are located in path in global variable [?]
« Reply #2 on: January 07, 2014, 06:05:37 am »
Could I add files to a project (to compile and link) that are located in path in global variable?
The PATH envvar is used by command line processors to find executable and libraries, not general (text) files. It woudn't make sense, really.

I don't didn't mean the PATH env variable, I mean a path in a global variable, ex: I unzip some source(.c) files in /home/some/random/path, in Linux I create a global variable 'GLOB_VAR' and set it to /home/some/random/path but in Windows I set 'GLOB_VAR=X:/some/random/path/', then, in some project I add a .c file that is located on '/home/some/random/path' or in 'X:...', I know I could use relative paths but...

PD: Sorry if I did not express myself (In english).
« Last Edit: January 07, 2014, 06:53:49 am by Totoxa »

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: Add file to project that are located in path in global variable [?]
« Reply #3 on: January 07, 2014, 08:42:00 am »
Mmmh... You know that this is really error prone? So it is not supported directly. However, there is a hidden "glob" feature for Code::Blocks that can do such. Search the forums accordingly.

But I can really only recommend to use the add files recursively" option and do it properly otherwise you'll end up with well hidden errors sooner or later...
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5258
Re: Add file to project that are located in path in global variable [?]
« Reply #4 on: January 07, 2014, 01:31:30 pm »
the glob feature can do this for you, there is no gui interface for it yet, so you need to adjust your cbp file in an editor.

Remember to reload the project the moment you added/removed files in that directory

Example :
Code: [Select]
<UnitsGlob directory="../export/" recursive="1" wildcard="" />
<UnitsGlob directory="../local/" recursive="1" wildcard="" />

You put this at the spot where normally the <Units> would exist. wildcard empty means the rules that cb use (just like when you add files via the gui interface), but you can specify your own wildcard pattern.