Page 1 of 1

Not able to use Environment Variable during build

Posted: Tue Feb 26, 2013 12:49 am
by chintanpatel7
Hello,

I want to use dynamic path for source files.
For example I want to copy file from path C:\Project source
So I have set Environment Variable SOURCE_PATH to "C:\Project source" and used it in Install file command as per following:

Code: Select all

Install Files %SOURCE_PATH%\test.txt to $TARGETDIR$
As per my thinking it should parse this command as

Code: Select all

Install Files C:\Project source\test.txt to $TARGETDIR$
But when I try to compile or build my project it is giving me following error:
No Files matching pattern "c:\test project\%SOURCE_PATH%\test.txt"
I think this is happening because it it taking relative path to my project folder [i.e. C:\test project].
But it is not parsing value of SOURCE_PATH environment variable.

I am wondering because I have done same in my previous project and it is successfully taking source files from the path described in Environment variable used in it.

Is there anything I am missing? Please help.

Thanks,
Chintan

Re: Not able to use Environment Variable during build

Posted: Tue Feb 26, 2013 5:05 am
by FrancescoT
Dear Chintan,

by the error you are receiving, I suppose the environment variable you used it is not correctly defined.

For example, I done the following;

1- Under "Control Panel ->System & Security->System->Advanced system settings->Advanced->Environment variables", I defined MYPATH = c:\mypath under System variables.
2- Restarted the system
3- Finally I used "%MYPATH%\myfile.rtf" with the Source Path parameter of the Install Files command.

... and works!

Regards

Re: Not able to use Environment Variable during build

Posted: Tue Feb 26, 2013 5:31 am
by chintanpatel7
Hi Francesco,

Yes it was my fault. I have set the environment variable, used it properly but DIDN'T RESTART... :oops:

I have restarted the system and now it is working fine... :D

Thanks a lot,
Chintan

Re: Not able to use Environment Variable during build

Posted: Tue Feb 26, 2013 9:17 am
by FrancescoT
:D