Page 1 of 2
Relative paths to files
Posted: Sun May 23, 2010 4:22 am
by prezmer
Hello,
Is IA capable of using relative paths to store locations of the files that should be included in the install package? I checked the forum, documentation, but only found that IA >=7 uses relative paths for location of script files. There's an option "Project | Files Paths" that scans a project for hardcoded paths, but it seems that changing absolute path into relative path does not work.
Usage of relative paths is a necessity if we want to use IA in continous integration environment. If we want to be able to compile whole project automatically, it should not depend on location of checked out files.
Re: Relative paths to files
Posted: Sun May 23, 2010 5:11 am
by prezmer
Using Compiler variables might be a walkaround. It can be achieved by design view | Setup architecture | Files, then "Edit file" in target files table. Following dialog appears

.
Don't worry about hint that "no variables are allowed". I used "PROJDIR" var. It works for standard files, I didn't check it against installing NT services.
Re: Relative paths to files
Posted: Sun May 23, 2010 7:59 am
by prezmer
prezmer wrote: I didn't check it against installing NT services.
I checked the NT services. Unfortunately it doesn't work. It looks like the service exe is not included into output package. I started compiling using miabuild and saw following messages:
Copied file C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\src\SQL_DEF.ini
Copied file C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\src\status.ini
Copied file C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\bin\AIGDPpwdSetup.exe
Copied file C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\dist\libeay32.dll
Copied file C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\dist\ssleay32.dll
Copied file C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\dist\AIGDATAPROVIDER.ini
Copied service C:\Users\ens00033\Desktop\WORKSP~1\sandbox\DELPHI~1\build\.\IA\..\..\bin\AIGDataProvider.exe
The problem is that I cannot find service file in output package, but other files exist there.
I'm using IA 9 but I can't be precise about version. Control Panel (Add remove programs) says it's 9.07.9007.2010 but inside IA IDE (Version button) says it's: 9 (Build Moya.sp1.070409) Why sp1 not sp2 as downloade web page says?
Re: Relative paths to files
Posted: Sun May 23, 2010 8:44 am
by prezmer
It seems that it's an old problem found several years ago.
Here's an old thread:
http://www.installaware.com/forum/viewt ... ices#p9054
I have no idea for workaround

. So the problem is related to "..".To solve it, I would need to move all compiled services into IA project directory which is not elegant solution and requires changes in external projects
Re: Relative paths to files
Posted: Sun May 23, 2010 3:35 pm
by MichaelNesmith
Relative paths are unsupported.
Compiler variables may be used, regular variables are disallowed since the build happens at compile time and not runtime.
Just use compiler variables without relative paths!
Re: Relative paths to files
Posted: Mon May 24, 2010 4:42 am
by prezmer
Yes, I'm using compiler variables (surrounded by #..# signs), also for service files. But following structure:
#PROJDIR#\..\..\bin\AIGDataProvider.exe
didn't work. Is it relative or absolute path

? Can you see any workaround?
Re: Relative paths to files
Posted: Mon May 24, 2010 5:11 am
by ALive
Don't use "\..\" and you'll be fine. As a #PROJDIR# select the upper parent folder for all off your projects. In your case, i guess, it's 2 level up.
Hope this helps.
Re: Relative paths to files
Posted: Mon May 24, 2010 5:51 am
by MichaelNesmith
That is correct, "..\" is still a relative path. This has been added as a feature request to R&D so the next InstallAware release ought to support relative paths well.
Re: Relative paths to files
Posted: Mon May 24, 2010 7:17 am
by prezmer
ALive wrote:Don't use "\..\" and you'll be fine. As a #PROJDIR# select the upper parent folder for all off your projects. In your case, i guess, it's 2 level up.
My directory structure looks like this:
<PROJECT-NAME>
---<BIN> <-- binary files created by compilers
---<BUILD> <-- here lie scripts for automatic compilation
--------<IA> <-- here lies IA project
---<DIST> <-- external files attached to installed application
---<DOC> <-- project documentation
---<SRC> <-- source files for language compilers
---<TEST> <-- *unit tests and test related files
---<UTILS> <-- extra source files
I have buildInstaller.cmd inside <BUILD> folder. It contains:
miabuild ".\IA\myProject.mpr" /b=1
Installer relates to files stored in BIN,DIST folders. #PROJDIR# will point to BUILD\IA folder. Is there any chance to keep the directory structure and set paths properly?
Re: Relative paths to files
Posted: Mon May 24, 2010 7:22 am
by ALive
I guess yeah.
for the miabuild, just use: miabuild <Project-Name>\<IA>\Project.mpr
inside your project, just use:
#PROJDIR#\bin\AIGDataProvider.exe
where #PROJDIR# is the path to <PROJECT-NAME>
Hope this helps!
Re: Relative paths to files
Posted: Mon May 24, 2010 7:36 am
by prezmer
ALive wrote:
#PROJDIR#\bin\AIGDataProvider.exe
That would point to
<PROJECT-NAME>\BUILD\IA\BIN\AIGDataProvider.exe
but the file is located in
<PROJECT-NAME>\BIN
So it will fail

Re: Relative paths to files
Posted: Mon May 24, 2010 7:59 am
by ALive
Hold on a sec.
First of all, it should work, because we used it in this way

. I guess it will be a relaxing word

.
Let's go from the start:
#PROJDIR# should point to the upper parent folder for all projects, including IA and the folder where your BIN located. I guess it should be (as an example):
let's guess your PROJECT-NAME folder is located inside: "C:\Projects\SomeProjectNameFolder", so in this case #PROJDIR# should point inside that folder.
You should provide this compiler variable with this value:
Code: Select all
miabuild.exe C:\Projects\SomeProjectNameFolder\BUILD\IA\SetupProject.mpr PROJDIR=C:\Projects\SomeProjectNameFolder
simply use: #PROJDIR#\BIN\AIGDataProvider.exe for the Install Files command
Specifying the path to your *.mpr (installer project) file is a duty of your build process routine, not InstallAware, that's why i used it with absolute path (C:\Projects\SomeProjectNameFolder\BUILD\IA\SetupProject.mpr).
We're using AntBuild, and inside our build process scripts we have another variable wich stores the path for all out projects. It is relative to this path you should point to the Installer Project *.mpr file.
Hope it helps.
Re: Relative paths to files
Posted: Mon May 24, 2010 8:45 am
by prezmer
ALive wrote:
You should provide this compiler variable with this value:
Code: Select all
miabuild.exe C:\Projects\SomeProjectNameFolder\BUILD\IA\SetupProject.mpr PROJDIR=C:\Projects\SomeProjectNameFolder
Thanks, I get your point. I didn't think about overriding default value of PROJDIR
How did you automate setting for PROJDIR value? I was thinking about %CD% environment variable but that would require calling script from upper folder than <build>
Re: Relative paths to files
Posted: Mon May 24, 2010 9:00 am
by prezmer
I found a way to determine parent directory of the script. Something like this:
cd ..
SET MYDIR=%CD%
cd build
miabuild ".\IA\AIG Data Provider.mpr" /b=1 ROOTDIR=%myDir%
Compiler variable ROOTDIR is used only for Services. "Install Files" allows for using #PROJDIR#\..\..
Re: Relative paths to files
Posted: Mon May 24, 2010 5:27 pm
by MichaelNesmith
You should still avoid using ..\ until InstallAware officially supports them (coming soon).
You can use the Refactor Paths tool to quickly update all your hard coded paths to use compiler variables and subfolders without having to manually update each path or having to use relative folders.