Merge branch 'master' into codex/agc-browser-orphan-cleanup
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m42s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m11s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 7m57s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 7m9s
Project CI / Backend tests (pull_request) Successful in 5m54s
Project CI / Native shell tests (pull_request) Successful in 7m50s
Project CI / Frontend tests (pull_request) Successful in 4m31s
Project CI / Repository checks (pull_request) Successful in 4m15s
Project CI / AI game creator shell web tests (pull_request) Successful in 4m37s
Project CI / AI game creator shell Rust smoke (pull_request) Successful in 1m42s
Project CI / AI game creator shell Rust crates (pull_request) Successful in 1m11s
Project CI / AI game creator shell Rust lane 1/2 (pull_request) Successful in 7m57s
Project CI / AI game creator shell Rust lane 2/2 (pull_request) Successful in 7m9s
Project CI / Backend tests (pull_request) Successful in 5m54s
Project CI / Native shell tests (pull_request) Successful in 7m50s
Project CI / Frontend tests (pull_request) Successful in 4m31s
Project CI / Repository checks (pull_request) Successful in 4m15s
Project CI / AI game creator shell web tests (pull_request) Successful in 4m37s
This commit is contained in:
@@ -88,15 +88,21 @@ export function resolveNsisCacheDir(
|
||||
env = process.env,
|
||||
platform = process.platform,
|
||||
) {
|
||||
const pathImpl = platform === 'win32' ? path.win32 : path.posix;
|
||||
const explicit = env.AGC_TAURI_NSIS_CACHE_DIR?.trim();
|
||||
if (explicit) return path.resolve(explicit);
|
||||
if (explicit) return pathImpl.resolve(explicit);
|
||||
// Jenkins Windows 节点以 SYSTEM 运行,ProgramData 稳定可写且不受工作区清理影响;
|
||||
// 缓存里只有待解压的原始归档,不会从该目录执行任何程序。
|
||||
if (platform === 'win32') {
|
||||
const programData = env.ProgramData?.trim() || 'C:\\ProgramData';
|
||||
return path.join(programData, 'genarrative', 'tauri-nsis-cache');
|
||||
return pathImpl.join(programData, 'genarrative', 'tauri-nsis-cache');
|
||||
}
|
||||
return path.join(os.homedir(), '.cache', 'genarrative', 'tauri-nsis-cache');
|
||||
return pathImpl.join(
|
||||
os.homedir(),
|
||||
'.cache',
|
||||
'genarrative',
|
||||
'tauri-nsis-cache',
|
||||
);
|
||||
}
|
||||
|
||||
/** 与 tauri-bundler 相同的镜像开关语义,便于构建机绕过不可达的 GitHub。 */
|
||||
|
||||
@@ -7,6 +7,7 @@ import { test } from 'node:test';
|
||||
import JSZip from 'jszip';
|
||||
|
||||
import {
|
||||
defaultAppRoot,
|
||||
ensureNsisToolset,
|
||||
extractNsisArchive,
|
||||
NSIS_ARCHIVE_ASSET_NAME,
|
||||
@@ -23,10 +24,7 @@ import {
|
||||
verifyNsisToolset,
|
||||
} from './nsis-toolset.mjs';
|
||||
|
||||
const appRoot = path.resolve(
|
||||
path.dirname(new URL(import.meta.url).pathname),
|
||||
'..',
|
||||
);
|
||||
const appRoot = defaultAppRoot();
|
||||
const silentLogger = { log() {}, warn() {} };
|
||||
|
||||
function createSandbox() {
|
||||
@@ -98,6 +96,14 @@ test('NSIS 工具链目录与 Tauri useLocalToolsDir 配置保持一致', () =>
|
||||
});
|
||||
|
||||
test('缓存目录默认落在工作区之外并支持环境变量覆盖', () => {
|
||||
assert.equal(
|
||||
resolveNsisCacheDir({ AGC_TAURI_NSIS_CACHE_DIR: 'D:\\agc-cache' }, 'win32'),
|
||||
'D:\\agc-cache',
|
||||
);
|
||||
assert.equal(
|
||||
resolveNsisCacheDir({ ProgramData: 'D:\\ProgramData' }, 'win32'),
|
||||
path.win32.join('D:\\ProgramData', 'genarrative', 'tauri-nsis-cache'),
|
||||
);
|
||||
assert.equal(
|
||||
resolveNsisCacheDir(
|
||||
{ AGC_TAURI_NSIS_CACHE_DIR: '/tmp/agc-cache' },
|
||||
@@ -105,13 +111,9 @@ test('缓存目录默认落在工作区之外并支持环境变量覆盖', () =>
|
||||
),
|
||||
'/tmp/agc-cache',
|
||||
);
|
||||
assert.equal(
|
||||
resolveNsisCacheDir({ ProgramData: 'D:\\ProgramData' }, 'win32'),
|
||||
path.join('D:\\ProgramData', 'genarrative', 'tauri-nsis-cache'),
|
||||
);
|
||||
assert.ok(
|
||||
resolveNsisCacheDir({}, 'linux').endsWith(
|
||||
path.join('.cache', 'genarrative', 'tauri-nsis-cache'),
|
||||
path.posix.join('.cache', 'genarrative', 'tauri-nsis-cache'),
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user