Summary
-------
Support both system-wide and per-user configuration of a jpackaged application.
Problem
-------
There is no way to set per-user startup parameters for application launchers for installed jpackaged applications.
Installation of jpackaged application is system-wide.
Configurations parameters are stored in `.cfg` property files in the system-wide installation directory thus only system-wide configuration is supported.
In some cases user-specific startup parameters need to be specified. Currently, there is no way to do it because startup parameters are stored in the system-wide installation location.
Solution
--------
Add support to jpackage application launcher to look up the corresponding `.cfg` file not only in the application installation directory (the system-wide installation location) but also in user-specific locations.
Specification
-------------
Application launcher of the installed application will look up the corresponding `.cfg` file in user-specific directories. If `.cfg` file is not found, the application launcher will load `.cfg` file from the installation directory.
Application launcher executed from application image, i.e. not from the installed application will not look up the corresponding `.cfg` file in user-specific directories. It will load the corresponding `.cfg` file from the application image directory.
User-specific directories for `.cfg` file look up will be:
## Linux
1. `~/.local/${PACKAGE_NAME}`
2. `~/.${PACKAGE_NAME}`
## macOS
1. `~/Library/Application Support/${PACKAGE_NAME}`
## Windows
1. `%LocalAppData%\%PACKAGE_NAME%`
2. `%AppData%\%PACKAGE_NAME%`
`${PACKAGE_NAME}` and `%PACKAGE_NAME%` refer to jpackaged application name.
E.g.: for a fictional application named `Duke` main application launcher will use the first existing `.cfg` file from the list:
## Linux
1. `~/.local/duke/Duke.cfg`
2. `~/.duke/Duke.cfg`
3. `/opt/duke/lib/app/Duke.cfg`
## macOS
1. `~/Library/Application Support/Duke/Duke.cfg`
2. `/Applications/Duke.app/Contents/app/Duke.cfg`
## Windows
1. `%LocalAppData%\Duke\Duke.cfg`
2. `%AppData%\Duke\Duke.cfg`
3. `%ProgramFiles%\Duke\app\Duke.cfg`
E.g.: for a fictional application named `Duke` additional application launcher named `other-duke` will use the first existing `.cfg` file from the list:
## Linux
1. `~/.local/duke/other-duke.cfg`
2. `~/.duke/other-duke.cfg`
3. `/opt/duke/lib/app/other-duke.cfg`
## macOS
1. `~/Library/Application Support/Duke/other-duke.cfg`
2. `/Applications/Duke.app/Contents/app/other-duke.cfg`
## Windows
1. `%LocalAppData%\Duke\other-duke.cfg`
2. `%AppData%\Duke\other-duke.cfg`
3. `%ProgramFiles%\Duke\app\other-duke.cfg`