User forums > Using Code::Blocks

Add file to project that are located in path in global variable [?]

(1/1)

Totoxa:
Could I add files to a project (to compile and link) that are located in path in global variable?

MortenMacFly:

--- Quote from: 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?

--- End quote ---
The PATH envvar is used by command line processors to find executable and libraries, not general (text) files. It woudn't make sense, really.

Totoxa:

--- Quote from: MortenMacFly on January 06, 2014, 09:02:33 am ---
--- Quote from: 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?

--- End quote ---
The PATH envvar is used by command line processors to find executable and libraries, not general (text) files. It woudn't make sense, really.

--- End quote ---

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).

MortenMacFly:
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...

killerbot:
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="" />

--- End code ---

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.

Navigation

[0] Message Index

Go to full version