修复AGC在Windows上的启动失败
通过子进程私有环境变量传递DACL目标路径,避免PowerShell命令参数解析失败。 同步补充AI游戏创作实施方案和项目踩坑记录。
This commit is contained in:
@@ -31,8 +31,8 @@ const npmCommand = process.platform === 'win32' ? 'npm.cmd' : 'npm';
|
||||
|
||||
const windowsPrivateAclScript = String.raw`
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$target = [System.IO.Path]::GetFullPath($args[0])
|
||||
$isDirectory = [System.Boolean]::Parse($args[1])
|
||||
$target = [System.IO.Path]::GetFullPath($env:GENARRATIVE_AGC_PRIVATE_PATH)
|
||||
$isDirectory = [System.Boolean]::Parse($env:GENARRATIVE_AGC_PRIVATE_IS_DIRECTORY)
|
||||
$currentSid = [System.Security.Principal.WindowsIdentity]::GetCurrent().User
|
||||
$inheritance = [System.Security.AccessControl.InheritanceFlags]::None
|
||||
if ($isDirectory) {
|
||||
@@ -297,9 +297,13 @@ export async function secureWindowsGameCreatorPathForCurrentUser(
|
||||
'Bypass',
|
||||
'-Command',
|
||||
windowsPrivateAclScript,
|
||||
targetPath,
|
||||
String(isDirectory),
|
||||
]);
|
||||
], {
|
||||
env: {
|
||||
...process.env,
|
||||
GENARRATIVE_AGC_PRIVATE_PATH: targetPath,
|
||||
GENARRATIVE_AGC_PRIVATE_IS_DIRECTORY: String(isDirectory),
|
||||
},
|
||||
});
|
||||
if (result.code !== 0 || result.signal) {
|
||||
const detail = result.stderr.trim() || result.stdout.trim();
|
||||
throw new Error(
|
||||
|
||||
Reference in New Issue
Block a user