使用 FreePascal 查找 $HOME 或 Windows 等效项

发布于 2024-07-19 16:11:09 字数 213 浏览 8 评论 0原文

下部署用户配置文件

  • 我的目的是在 Unix/Linux 的 $HOME/.appname
  • 。 Windows 的 \Documents and Settings\(user)\Application Data\AppName。

我可以使用哪些 API 或函数组,以及适当的 {$IFDEF},以便我可以将配置文件部署到适当的位置?

My purpose is to deploy user configuration files under:

  • $HOME/.appname for Unix/Linux.
  • \Documents and Settings\(user)\Application Data\AppName for Windows.

What are the API's or group of functions that I can use, with the appropriate {$IFDEF}'s, so I can deploy my config files on the appropriate places?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

余罪 2024-07-26 16:11:09

更好地使用正确的函数:

http://www.freepascal.org/ docs-html/rtl/sysutils/getappconfigdir.html

结果:=getappconfigdir(false)

Better use the correct function:

http://www.freepascal.org/docs-html/rtl/sysutils/getappconfigdir.html

result:=getappconfigdir(false)

白鸥掠海 2024-07-26 16:11:09

您可能最终会使用 GetEnvironmentVariable函数。 在类 Unix 操作系统下,您将使用 HOME 环境变量。 在 Windows 下,您将使用 APPDATA 环境变量。

You'll likely end up using the GetEnvironmentVariable function. Under Unix-like OSs, you will use the HOME environment variable. Under Windows, you'll use the APPDATA environment variable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文