Build Event fails because of not using relative paths - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

rho
Posts: 69
Joined: Tue May 12, 2009 1:22 pm

Build Event fails because of not using relative paths

I have a pre-build event which calls a custom exe file which is located right next to the aip file.
Despite it is located right next to it, AI seems to use the path where I last added files from.
To reproduce:
- My "command" for the build event is "mycustom.exe". When I choose the file, it writes "D:\myfolder\mycustom.exe" to the command field. As "D:" is not present at the build server I change this to "mycustom.exe".
- Hit build and everything works fine.

- Add new files in "Files and Folders", hit save, rebuild > the build event will fail, it cant find "mycustom.exe"
- I have to re-set the command by choosing mycustom.exe again and adapt the path as described above.

> please change this behavior so it uses relative paths as all other parts of AI do.

I'm on 9.3 buil 45535 Enterprise
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Build Event fails because of not using relative paths

Hello,

Please keep in mind that when "Add an executable file as a custom event" to your project you should use only an absolute path in the "Command" field. So, you should use an absolute path to your executable file in order to obtain what you want.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rho
Posts: 69
Joined: Tue May 12, 2009 1:22 pm

Re: Build Event fails because of not using relative paths

Unfortunately this doesn't fit to our environment. I can't use absolute paths as I've described above already.
Until I started using build events, the aip could be run and built from any drive it was located on as all paths are defined as relative paths automatically by AI.
It just doesn't make sense to define an absolute path for build events but have anything else as a relative path.
By placing an absolute path as command, the buildserver or my PC are not able to build the aip anymore. One will fail because it doesn't have the path.

If I put a file copy event in there, "cmd.exe" is not an absolute path either. AI relies on the PATH variable so the path to cmd.exe can be resolved ...

As I can put properties in the command field: is there a property which holds the current path to the aip-file, the current drive or similar?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Build Event fails because of not using relative paths

Hello,

In order to achieve what you want you can use the "AI_AIP_FOLDER" property which is resolved, at build time, to the folder path of the .aip file. So, you can set the "Command" field for your pre-build event to something like this:

Code: Select all

[|AI_AIP_FOLDER]mycustom.exe

Let us know if this helped.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
rho
Posts: 69
Joined: Tue May 12, 2009 1:22 pm

Re: Build Event fails because of not using relative paths

Thanks, this works as expected.
For completeness: I had to put [|AI_AIP_FOLDER] in front of my relative path arguments which are handed to the exe, too.

Return to “Common Problems”