From 98199724788194421ca17ad96b4c90adb2908fae Mon Sep 17 00:00:00 2001 From: stormbirds Date: Fri, 27 Mar 2026 17:49:14 +0800 Subject: [PATCH] =?UTF-8?q?fix(core):=20=E4=BF=AE=E5=A4=8DWindows=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0=E4=B8=8B=E7=BC=93=E5=AD=98=E7=9B=AE=E5=BD=95=E8=B7=AF?= =?UTF-8?q?=E5=BE=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在Windows平台上,URL的pathname以/C:/开头,需要移除前导斜杠并规范化路径分隔符, 确保路径拼接正确。 --- index.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.ts b/index.ts index 1cb3c16..9ec3435 100644 --- a/index.ts +++ b/index.ts @@ -48,7 +48,14 @@ const ALWAYS_LOAD_SKILLS = ["using-superpowers"]; function getCacheDir(): string { // Plugin directory is where this file is located const pluginDir = path.dirname(new URL(import.meta.url).pathname); - return path.join(pluginDir, CACHE_DIR_NAME); + + // On Windows, pathname from URL starts with /C:/ or similar + // We need to remove the leading slash for proper path joining + const normalizedPluginDir = process.platform === 'win32' && pluginDir.startsWith('/') + ? pluginDir.substring(1).replace(/\//g, '\\') + : pluginDir; + + return path.join(normalizedPluginDir, CACHE_DIR_NAME); } /**