title: JXA NSFileManager createDirectoryAtPathWithIntermediateDirectoriesAttributesError exception
body: <p>I'm using the following JXA (JavaScript for Automation) code on OS/X 10.11.5:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function createFolder(path, createIntermediateDirectories) {
      var error = {}
      $.NSFileManager.defaultManager
          .createDirectoryAtPathWithIntermediateDirectoriesAttributesError(
              $(path).stringByStandardizingPath, 
              createIntermediateDirectories, 
              null, 
              error);
      if (error)
          throw Error("Could not create folder '" + path + "'");
  };</code></pre>
  </div>
  </div>
  </p>
  
  <p>I get an error when running this, although it actually does create the folder. Here's the error:</p>
  
  <blockquote>
    <p>Error: exception raised by object: -[NSNull objectForKey:]:
    unrecognized selector sent to instance 0x7fff7b69b780 (-2700)</p>
  </blockquote>
  
  <p>Judging by the fact that the folder is actually created, and the text of the error message, I'm assuming the issue is with the "attributes" parameter, which is null (nil). I figure that it creates the folder, then goes to assign the attributes, and that's when it fails.</p>
  
  <p>Anyone got any ideas how to fix this? I haven't had any trouble calling any of the other NSFileManager methods from JXA, including those to which I pass null and/or boolean values, so this has be stumped.</p>
  
  <p>Appreciate any help.</p>