# Dynamic search path for delphi

**URL:** https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363
**Category:** Discussion
**Created:** [February 19, 2007, 3:30am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363 "2007-02-19T03:30:07Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 19, 2007, 3:30am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/1 "2007-02-19T03:30:07Z")

</div>

Hi

I need a different search path for Delphi compilation each run. I use the action Compile delphi Win32 Project, Tab Directories&nbsp; Library path: Here I enter a long path and everything is fine. Biut when I try to do it dynamically thru a veraible, which I set before, to the same path, &nbsp;I get the error :

Error expanding variables in Library or Search Path : Variable : DELPHI - does not exist!  
I saw that there was a question about this in the past. I am using FB5 5.0.0.60

Am i missing something?

thanks Daphna Levin

&nbsp;

&nbsp;

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [February 20, 2007, 6:20am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/2 "2007-02-20T06:20:08Z")

</div>

What value is in your variable that you’re putting for the library path?  
  
There are a couple of “magic” values that you can specify in a library or search path that FB will automatically replace for you - these values are $(DELPHI), $(BCB), and $(BDS). You can’t use the %'s instead for these special variables.  
  
.t8

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 20, 2007, 8:27am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/3 "2007-02-20T08:27:10Z")

</div>

well I do

Set Variable COMP\_PATH to Z:\OUTPUT\DCP;Z:\OUTPUT\BPL;$(DELPHI)\Lib;$(DELPHI)\Bin;$(DELPHI)\Imports;$(DELPHI)\Projects\Bpl;$(DELPHI)\source\ToolsApi;Z:\Lib\Delphi\Libs\Dates\4.0;Z:\Lib\Delphi\Libs\EventLog\1.0; ...

(the variable is very long)

and then in the Delphi I use this variable as I mentioned before. I didn't understand what should I do and how to combine the variables that use $(DELPHI) in the path.

Daphna

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [February 20, 2007, 9:07am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/4 "2007-02-20T09:07:31Z")

</div>

that usage looks fine, but what version of the Delphi compiler are you using? I think the $(DELPHI) variable only works up to D7, then you have to use $(BDS)  
  
.t8

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 20, 2007, 1:53am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/5 "2007-02-20T01:53:04Z")

</div>

I have Delphi 5.0 (6.18) and, as I mentioned when I use the full path in the FB Delphi action it works fine , with this&nbsp;&nbsp;path., the problem only occurs when I try to use a variable COMP\_VAR&nbsp;, set it to the same string, and then in the FB write %COMP\_VAR%. The FB doesn’t like it .

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [February 21, 2007, 6:05am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/6 "2007-02-21T06:05:23Z")

</div>

ok, the reason is that FB does a replacement of all $(DELPHI) “pseudo” variables first, and then does the normal expansion. It has to be done this way otherwise the $(DELPHI) will get treated as a normal variable. So - end result is that you can’t have those $(DELPHI) strings in your COMP\_VAR variable… sorry.  
  
.t8

---

<div class="post-metadata">

### Author: ![deleted\_user](https://www.finalbuilder.com/forums/user_avatar/www.finalbuilder.com/deleted_user/32/937_2.png) [@deleted\_user](https://www.finalbuilder.com/forums/u/deleted_user)
#### Post date: [February 22, 2007, 12:24pm UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/7 "2007-02-22T12:24:34Z")

</div>

So do you have any other solution to the problem?

---

<div class="post-metadata">

### Author: ![tate](https://www.finalbuilder.com/forums/letter_avatar_proxy/v4/letter/t/e19b73/32.png) [@tate](https://www.finalbuilder.com/forums/u/tate)
#### Post date: [February 22, 2007, 11:33am UTC](https://www.finalbuilder.com/forums/t/dynamic-search-path-for-delphi/363/8 "2007-02-22T11:33:51Z")

</div>

Daphna,  
  
Can you split the library path into two parts, one that is always required, and the other loaded from a variable?  
  
eg. LibraryPath = $(DELPHI)\Lib;$(DELPHI)\Bin;$(DELPHI)\Imports;$(DELPHI)\Projects\Bpl;$(DELPHI)\source\ToolsApi;%COMP\_VAR%  
  
%COMP\_VAR% = Z:\OUTPUT\DCP;Z:\OUTPUT\BPL;Z:\Lib\Delphi\Libs\Dates\4.0;Z:\Lib\Delphi\Libs\EventLog\1.0;
