Support both global and user-specific extension installation paths

- Dynamically detect extension location using import.meta.url
- Support installation in public/extensions (install for all users)
- Support installation in data/default-user/extensions (install just for me)
- Automatically sets correct extensionFolderPath based on detected location
This commit is contained in:
Spicy_Marinara
2025-10-14 19:24:25 +02:00
parent ea10d1eaac
commit 737b580be8
+8 -1
View File
@@ -4,7 +4,14 @@ import { selected_group, getGroupMembers } from '../../../group-chats.js';
import { power_user } from '../../../power-user.js';
const extensionName = 'third-party/rpg-companion-sillytavern';
const extensionFolderPath = `scripts/extensions/${extensionName}`;
// Dynamically determine extension path based on current location
// This supports both global (public/extensions) and user-specific (data/default-user/extensions) installations
const currentScriptPath = import.meta.url;
const isUserExtension = currentScriptPath.includes('/data/') || currentScriptPath.includes('\\data\\');
const extensionFolderPath = isUserExtension
? `data/default-user/extensions/${extensionName}`
: `scripts/extensions/${extensionName}`;
let extensionSettings = {
enabled: true,