• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

get CEP folder path in jsx code.

Explorer ,
Oct 09, 2020 Oct 09, 2020

Copy link to clipboard

Copied

Hi, 

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

Thanks

TOPICS
Scripting

Views

1.4K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Explorer , Oct 10, 2020 Oct 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);

Votes

Translate

Translate
Explorer ,
Oct 10, 2020 Oct 10, 2020

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

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 10, 2020 Oct 10, 2020

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 10, 2020 Oct 10, 2020

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advocate ,
Nov 15, 2023 Nov 15, 2023

Copy link to clipboard

Copied

LATEST

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines