简体   繁体   中英

Saving an install directory for software

I have a software tool that I am working on in Java. It will be deployed to both Windows and Linux. I am at the phase where I am trying to determine the best course of action for saving the user's installation directory (where i will store all external files). Ideally I want the user to be able to move the program to any directory they choose (even after installation) and it will still be able to find the installation directory.

I have considered using environment variables to save the path but I am not sure if that is the best practice.

What is the standard practice for saving a path to an installation directory on Linux and Windows? (I am open to making different install logic for each OS)

Edit

After a bit more research, I have found that the /etc folder for linux is where I should store data and the Registry for windows. Can anyone confirm this?

In Windows, registry works great. Here's an example from a product I use (evo5.0 with eurovoiceHMP): Locations of config and logging folders can be configured manually via the registry, eurovoiceHMP and evo5.0 then "find" these folders under registry: HKLM/Software/eurovoice

Specific registry setting examples: HKLM/Software/eurovoice/HMP: evoHMPLicencePath C:\\ProgramData\\eurovoice\\HMP\\Config\\Licences.txt InstallPath E:\\hmpTest

HKLM/Software/eurovoice/evo50: evo50SystemVoiceFilesDir C:\\TeleSage\\sysvox InstallPath C:\\Program Files\\evo5.0 evo50LogDir C:\\TeleSage\\Logs

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM