Root directory of app

Post Reply
Meik
Newbie
Posts: 6
Joined: Tue Mar 26, 2024 11:02 am

Root directory of app

Post by Meik »

Hello,

I've created a new node.js-app. In that app I'm using jsx-scripts that are located inside of the script-folder. The paths to the jsx-scripts are set to fixed paths inside of the TypeScript-code. I want to keep them dynamic though. How can I get to that root-directory in my TypeScript-code?
Using

Code: Select all

const scriptFolder = __dirname; 
gives me the temporary script executor path ("/Applications/Enfocus/Enfocus Switch/ScriptExecutor/libs") which is of course not usable for my case since I need the original directory of the main.ts
laurentd
Member
Posts: 152
Joined: Wed Mar 13, 2019 2:06 pm

Re: Root directory of app

Post by laurentd »

You can add Extra files in your app, using SwitchScripter.
Then use getPluginResourcesPath() to get the path to that folder.
Laurent De Wilde, Solution Architect @ Enfocus
Meik
Newbie
Posts: 6
Joined: Tue Mar 26, 2024 11:02 am

Re: Root directory of app

Post by Meik »

thanks, works perfectly with the getPluginResourcesPath() function!
Post Reply