Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to make msi block installing to ProgramFiles folder?

I made the msi package to allow the user to choose installation directory for the application.

I want the user to only download the application where it doesn’t need read write permissions from the user, like %APP_DATA%/Roaming/my_app_example_name.
The reason being that the application has a self update mechanism and updates itself when it detects a new version on the server. The update itself doesn’t use an msi launcher, it just downloads the new version of the app from the server using a http request, and replaces the old files.

.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.


For example, in the popular game spiral knights, they implemented this mechanism like this:

asdfasdf

Here, you can see that the default installtation directory is the Appdata folder


enter image description here
If i change the installation directory to ProgramFiles, and try to install, I get this error :

enter image description here
It effectively blocks installation to the directory simply because it doesn’t have permissions to create a folder from the installer itself, there.

I would like to implement the same mechanism, or something similar, because I think this is a very elegant solution to my problem. So any ideas on how to do this?

(By the way, I’m using jpackage to create the msi launchers)


>Solution :

You can use --win-per-user-install option with jpackage.

On Windows, the default is c:\Program Files\application-name; if the
–win-per-user-install option is used, the default is C:\Users\user-name\AppData\Local\application-name

More details on options at jpackage docs

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading