macos Homedir

Contributor ,
Dec 13, 2020

Copy link to clipboard

Copied

Hi,

 

In a CEP project, I have a jsx script that returns a full path name of an AI document.

The js part uses that name to read a related text file (so, for somedoc.ai I want to read somedoc-features.txt)

On the mac, the jsx returns the ~ shorthand for the user's homedir. The cep readfile function cannot handle that. Currently I  am just replacing the tilde with a hardcoded /Users/Somename but I would certainly prefer to get the proper path from the system

Adobe Community Professional
Correct answer by Silly-V | Adobe Community Professional

Try to use this property of the file object: .fsName - It will show your OS's accurate filesystem name which is a full path and may return backslash delimiters for Windows.

TOPICS
Scripting

Views

40

Likes

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

macos Homedir

Contributor ,
Dec 13, 2020

Copy link to clipboard

Copied

Hi,

 

In a CEP project, I have a jsx script that returns a full path name of an AI document.

The js part uses that name to read a related text file (so, for somedoc.ai I want to read somedoc-features.txt)

On the mac, the jsx returns the ~ shorthand for the user's homedir. The cep readfile function cannot handle that. Currently I  am just replacing the tilde with a hardcoded /Users/Somename but I would certainly prefer to get the proper path from the system

Adobe Community Professional
Correct answer by Silly-V | Adobe Community Professional

Try to use this property of the file object: .fsName - It will show your OS's accurate filesystem name which is a full path and may return backslash delimiters for Windows.

TOPICS
Scripting

Views

41

Likes

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
Dec 13, 2020 0
Adobe Community Professional ,
Dec 13, 2020

Copy link to clipboard

Copied

Try to use this property of the file object: .fsName - It will show your OS's accurate filesystem name which is a full path and may return backslash delimiters for Windows.

Likes

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
Reply
Loading...
Dec 13, 2020 1
Contributor ,
Dec 16, 2020

Copy link to clipboard

Copied

Hi,

 

many thanks, I will give it a try later.

BTW, on the windows side cep panels and jsx scripts have different opinions on drive letter and its colon 😞

Likes

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
Reply
Loading...
Dec 16, 2020 1
Resources