From 737b580be84c3067b29e07c421beec7fa0ca1340 Mon Sep 17 00:00:00 2001 From: Spicy_Marinara Date: Tue, 14 Oct 2025 19:24:25 +0200 Subject: [PATCH] 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 --- index.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/index.js b/index.js index 8e5abd7..d1b4221 100644 --- a/index.js +++ b/index.js @@ -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,