Copy link to clipboard
Copied
Hi,
I wanted to know how we can get CEP extension folder path in jsx code.
Thanks
Can't seem to edit my post, nothing loads when I click more.
Any way I missed a ) at the end
var csInterface = new CSInterface();
locatoin = csInterface.getSystemPath(SystemPath.EXTENSION);
Copy link to clipboard
Copied
You can either pass the location from your JS to your JSX, getting the location using:
var csInterface = new CSInterface();
locatoin = csInterface.getSystemPath(SystemPath.EXTENSION;
Or you can get the folder location of the JSX file and use .parent to go back to the root folder.
var folder = File($.fileName).parent.toString(); //This will get the folder your jsx is in add more .parent if you want to go further back
var file = File(folder + "/testFile.json");
app.open(file);
Copy link to clipboard
Copied
Can't seem to edit my post, nothing loads when I click more.
Any way I missed a ) at the end
var csInterface = new CSInterface();
locatoin = csInterface.getSystemPath(SystemPath.EXTENSION);
Copy link to clipboard
Copied
Damn not being able to edit is a pain.
You can also ignore the line
app.open(file)
I copy and pasted from another time I needed the snippet.
Copy link to clipboard
Copied
Curious why on Windows we dont seem to have write permission to the CEP extension folder. On OSX i can easily write a JSON file with settings. But on Windows it jsut wont allow me to do so.
I tried you code with; var folderPath = File($.fileName).parent.parent; to get the root folder. It does return a path, but it wont write to that path. On windows that CEP extension folder seems to be read only