Relative paths to files

Got a problem you cannot solve? Try here.
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Relative paths to files

Post 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.
best regards
Piotr Rezmer
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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

Image.

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.
best regards
Piotr Rezmer
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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?
best regards
Piotr Rezmer
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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
best regards
Piotr Rezmer
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Relative paths to files

Post 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. :lol:

Just use compiler variables without relative paths!
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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?
best regards
Piotr Rezmer
ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Re: Relative paths to files

Post 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.
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Relative paths to files

Post 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.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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?
best regards
Piotr Rezmer
ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Re: Relative paths to files

Post 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!
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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 :(
best regards
Piotr Rezmer
ALive
Posts: 109
Joined: Mon Apr 27, 2009 5:54 am
Location: Russia

Re: Relative paths to files

Post 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.
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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>
best regards
Piotr Rezmer
prezmer
Posts: 31
Joined: Wed Jul 23, 2008 8:59 am
Location: Warsaw, Poland

Re: Relative paths to files

Post 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#\..\..
best regards
Piotr Rezmer
MichaelNesmith
Posts: 3452
Joined: Thu Dec 22, 2005 7:17 pm
Contact:

Re: Relative paths to files

Post 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.
Michael Nesmith
Install[b]Aware[/b]
[i]Home of The Next Generation MSI Installer[/i]
Get your free copy today - http://www.installaware.com/
Post Reply