javascript - JXA NSFileManager createDirectoryAtPathWithIntermediateDirectoriesAttributesError exception -


i'm using following jxa (javascript automation) code on os/x 10.11.5:

function createfolder(path, createintermediatedirectories) {      var error = {}      $.nsfilemanager.defaultmanager          .createdirectoryatpathwithintermediatedirectoriesattributeserror(              $(path).stringbystandardizingpath,               createintermediatedirectories,               null,               error);      if (error)          throw error("could not create folder '" + path + "'");  };

i error when running this, although create folder. here's error:

error: exception raised object: -[nsnull objectforkey:]: unrecognized selector sent instance 0x7fff7b69b780 (-2700)

judging fact folder created, , text of error message, i'm assuming issue "attributes" parameter, null (nil). figure creates folder, goes assign attributes, , that's when fails.

anyone got ideas how fix this? haven't had trouble calling of other nsfilemanager methods jxa, including pass null and/or boolean values, has stumped.

appreciate help.

sorry, don't have time now, here quick solution works fine here:

function createfolder(path, createintermediatedirectories) {     error = $()      $.nsfilemanager.defaultmanager.createdirectoryatpathwithintermediatedirectoriesattributeserror(         $(path).stringbystandardizingpath,          createintermediatedirectories,          $(),          error)      if (error) {         $.nslog(error.localizeddescription);     } }; 

have fun! michael / hamburg


Comments

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

unity3d - Fatal error- Monodevelop-Unity failed to start -