简体   繁体   English

保存软件的安装目录

[英]Saving an install directory for software

I have a software tool that I am working on in Java. 我有一个我正在使用Java工作的软件工具。 It will be deployed to both Windows and Linux. 它将部署到Windows和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? 在Linux和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. 经过一番研究后,我发现linux的/ etc文件夹是我应该存储数据的地方,以及用于windows的Registry。 Can anyone confirm this? 谁能证实这一点?

In Windows, registry works great. 在Windows中,注册表工作得很好。 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 以下是我使用的产品示例(带有eurovoiceHMP的evo5.0):可以通过注册表,eurovoiceHMP和evo5.0手动配置配置和日志文件夹的位置,然后在“注册表”下找到这些文件夹: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 / 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 HKLM / Software / eurovoice / evo50:evo50SystemVoiceFilesDir C:\\ TeleSage \\ sysvox InstallPath C:\\ Program Files \\ evo5.0 evo50LogDir C:\\ TeleSage \\ Logs

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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