Code::Blocks Forums

User forums => Using Code::Blocks => Topic started by: Totoxa on January 05, 2014, 11:15:59 pm

Title: Add file to project that are located in path in global variable [?]
Post by: Totoxa on January 05, 2014, 11:15:59 pm
Could I add files to a project (to compile and link) that are located in path in global variable?
Title: Re: Add file to project that are located in path in global variable [?]
Post by: MortenMacFly 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.
Title: Re: Add file to project that are located in path in global variable [?]
Post by: Totoxa 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).
Title: Re: Add file to project that are located in path in global variable [?]
Post by: MortenMacFly 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...
Title: Re: Add file to project that are located in path in global variable [?]
Post by: killerbot 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
		<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.