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

Scripting - Can't create directory on Mac

Contributor ,
Mar 14, 2020 Mar 14, 2020

Hi,

 

I'm working on an extension which works fine on Windows but has one little problem on Mac.

I'm not able to create the directory 'MY FOLDER'. Here is the code:

var myResourcesFolderPath = Folder.appData.toString() + encodeURI("/MYFOLDER/");
var myResourcesFolder = Folder(myResourcesFolderPath);

if (!myResourcesFolder.exists && !myResourcesFolder.create()){
alert("Cannot create folder");
return null;}

I can't understand what the problem is!

 

If I either change the code to

var myResourcesFolderPath = Folder.appData.toString() + encodeURI("/TESTFOLDER/MYFOLDER/");
var myResourcesFolder = Folder(myResourcesFolderPath);

if (!myResourcesFolder.exists && !myResourcesFolder.create()){
alert("Cannot create folder");
return null;}

 and manually create the folder 'TESTFOLDER', then the folder 'MYFOLDER' is created. What the heck?

 

Any ideas?

TOPICS
Error or problem , Scripting
321
Translate
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
LEGEND ,
Mar 15, 2020 Mar 15, 2020

Well, there is that annoying thing called user permissions even on Mac. It's actually logical - only manualyl creating a folder gives you correct write permissions for the script, which in turn means that your root permissions on the volume or parent original parent folder are restricted somehow. Check this stuff.

 

Mylenium

Translate
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
Contributor ,
Mar 22, 2020 Mar 22, 2020
LATEST

Yes I thought it was something related to user permissions.

I've changed

Folder.appData

to 

Folder.userData

and it now seems to work fine. 

Thanks!

Translate
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