Skip to main content
Masoud.Ghazi
Participating Frequently
October 9, 2020
Answered

get CEP folder path in jsx code.

  • October 9, 2020
  • 4 replies
  • 2194 views

Hi, 

I wanted to know how we can get CEP extension folder path in jsx code.

Thanks

This topic is closed to new replies. Start a new post to keep the conversation going.
Correct answer Greg5F9B

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);

4 replies

Participating Frequently
October 10, 2020

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);

 

Greg5F9BCorrect answer
Participating Frequently
October 10, 2020

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);
Participating Frequently
October 10, 2020

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.