hidden_machine
hidden_machine

Reputation: 191

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.

.

.


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)


Upvotes: 0

Views: 259

Answers (1)

Dhaval Gajjar
Dhaval Gajjar

Reputation: 2960

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

Upvotes: 1

Related Questions