fix(electron): work around Node.js cpSync Unicode crash on Windows (#686)

This commit is contained in:
paisley
2026-03-27 15:05:09 +08:00
committed by GitHub
Unverified
parent 537a85c4d1
commit aa98e59317
4 changed files with 116 additions and 22 deletions

View File

@@ -5,13 +5,14 @@
*
* All file I/O uses async fs/promises to avoid blocking the main thread.
*/
import { readFile, writeFile, access, cp, mkdir } from 'fs/promises';
import { readFile, writeFile, access, mkdir } from 'fs/promises';
import { existsSync } from 'fs';
import { constants } from 'fs';
import { join } from 'path';
import { homedir } from 'os';
import { getOpenClawDir, getResourcesDir } from './paths';
import { logger } from './logger';
import { cpAsyncSafe } from './plugin-install';
import { withConfigLock } from './config-mutex';
const OPENCLAW_CONFIG_PATH = join(homedir(), '.openclaw', 'openclaw.json');
@@ -220,7 +221,7 @@ export async function ensureBuiltinSkillsInstalled(): Promise<void> {
try {
await mkdir(targetDir, { recursive: true });
await cp(sourceDir, targetDir, { recursive: true });
await cpAsyncSafe(sourceDir, targetDir);
logger.info(`Installed built-in skill: ${slug} -> ${targetDir}`);
} catch (error) {
logger.warn(`Failed to install built-in skill ${slug}:`, error);
@@ -362,7 +363,7 @@ export async function ensurePreinstalledSkillsInstalled(): Promise<void> {
try {
await mkdir(targetDir, { recursive: true });
await cp(sourceDir, targetDir, { recursive: true, force: true });
await cpAsyncSafe(sourceDir, targetDir);
const markerPayload: PreinstalledMarker = {
source: 'clawx-preinstalled',
slug: spec.slug,