简体   繁体   English

Delphi 从哪里获得 BDSCOMMONDIR 的价值?

[英]Where does Delphi get value the BDSCOMMONDIR from?

One of my systems has a broken Delphi installation: it thinks BDSCOMMONDIR points to C:\\Windows\\system32\\9.0 whereas on a functioning system, it points to C:\\Users\\Public\\Documents\\RAD Studio\\9.0 .我的一个系统的 Delphi 安装损坏:它认为BDSCOMMONDIR指向C:\\Windows\\system32\\9.0而在正常运行的系统上,它指向C:\\Users\\Public\\Documents\\RAD Studio\\9.0

I'm probably the victim of corporate security madness, as I found out nobody can access the C:\\Users\\Public directory on the failing system anyway.我可能是公司安全疯狂的受害者,因为我发现无论如何没有人可以访问故障系统上的C:\\Users\\Public目录。

What I want is to move the content of the directory to a place where the developers can write, then globally (a subdirectory C:\\ProgramData comes to mind) and globally set the BDSCOMMONDIR .我想要的是将目录的内容移动到开发人员可以编写的地方,然后全局(想到子目录C:\\ProgramData )并全局设置BDSCOMMONDIR

So: where does Delphi get the BDSCOMMONDIR value from?那么:Delphi 从哪里获得BDSCOMMONDIR值?
How can I override it?我怎样才能覆盖它?

The major reason why it is holding me back is that I now get this on every compile/build I try:它阻碍我的主要原因是我现在在每次尝试编译/构建时都会得到这个:

[MakeDir Error] Unable to create directory "C:\Windows\system32\9.0\hpp\". Access to the path 'C:\Windows\system32\9.0\hpp\' is denied.
[MakeDir Error] Unable to create directory "C:\Windows\system32\9.0\Dcp". Access to the path 'C:\Windows\system32\9.0\Dcp' is denied.
[MakeDir Error] Unable to create directory "C:\Windows\system32\9.0\hpp". Access to the path 'C:\Windows\system32\9.0\hpp' is denied.

You can go to你可以去

Tools|Options|Environment Options|Environmental Variables工具|选项|环境选项|环境变量

double click on双击

BDSCOMMONDIR BDSCOMMONDIR

and set it to whatever you want.并将其设置为您想要的任何内容。

Also get a look at Where are environment variables stored in registry?还可以查看注册表中存储的环境变量哪里?

I now had access to a system with Delphi 2007 showing similar symptoms for which I used RegAlyzer to verify.我现在可以使用 Delphi 2007 访问显示类似症状的系统,我使用RegAlyzer 对其进行了验证。

By default, Delphi 2007 uses the SYSTEM setting of the environment variable from the registry:默认情况下,Delphi 2007 使用注册表中环境变量的SYSTEM设置:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment

It never gets the value from the USER environment variable key in the registry:永远不会从注册表中的USER环境变量键中获取值:

HKEY_CURRENT_USER\Environment

An override is stored by Delphi 2007 (which is BDS version 5.0) under this key: Delphi 2007(即 BDS 5.0 版)在此键下存储了一个覆盖

HKEY_CURRENT_USER\Software\Borland\BDS\5.0\Environment Variables

All three keys store regular REG_SZ name/value pairs (where name is BDSCOMMONDIR ).所有三个键都存储常规 REG_SZ 名称/值对(其中名称为BDSCOMMONDIR )。

My guess (I hope to eventually verify this) is that newer Delphi versions have similar behaviour because of backward compatibility.我的猜测(我希望最终验证这一点)是由于向后兼容性,较新的 Delphi 版本具有类似的行为。

Question is rather old but here is the correct answer for future readers: RAD Studio/Delphi doesn't store the BDSCOMMONDIR (and others) in the registry but you can find it in a file named rsvars.bat, inside the \\bin folder.问题很老,但这里是未来读者的正确答案:RAD Studio/Delphi 不会将 BDSCOMMONDIR(和其他人)存储在注册表中,但您可以在 \\bin 文件夹内名为 rsvars.bat 的文件中找到它。

Example extracted from my Delphi 10.3 Rio installation:从我的 Delphi 10.3 Rio 安装中提取的示例:

@SET BDS=C:\Delphi\Embarcadero\Studio\20.0
@SET BDSINCLUDE=C:\Delphi\Embarcadero\Studio\20.0\include
@SET BDSCOMMONDIR=C:\Users\Public\Documents\Embarcadero\Studio\20.0

unless you have manually overridden it through Environment Variables option.除非您通过环境变量选项手动覆盖它。 In that case, it will be under the registry key:在这种情况下,它将位于注册表项下:

HKEY_CURRENT_USER\\Software\\Embarcadero\\BDS<VERSION NUMBER>\\Environment Variables HKEY_CURRENT_USER\\Software\\Embarcadero\\BDS<版本号>\\环境变量

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

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