title: The "path" argument must be of type string. Received type undefined (fs module nodejs)
body: <p>I am trying to check if a file exists using fs module in nodejs. Please refer to the following code:</p>
  
  <pre><code>var path = require('path');
  let customXmlPath = (process.platform == 'darwin' ? path.join(__dirname, '../../MacOS/service/custom.xml') : path.join(__dirname, '../../service/custom.xml'));
  if (isDevelopment) {
      customXmlPath = (process.platform == 'darwin' ? path.join(__dirname, '../../../build/bin/darwin/release/custom.xml') : path.join(__dirname, '../../../build/bin/msvc/release/custom.xml'));
  }
  console.log(customXmlPath);
  
  const fs = require('fs');
  let productDisplayName = "xxxxxx";
  try {
      fs.accessSync(customXmlPath, fs.F_OK);
      let file = fs.readFileSync(customXmlPath, "utf8");
      var xmlr = require('../../../shared/electronUIshared/xmlreader.js').XMLReader;
      var datastore = xmlr.parse('config', file);
      if(datastore.getTotalCount() &gt; 0)
      {
          productDisplayName = datastore.getRecordAt(0).get('productname');
      }
  }
  catch(err) {
      console.log("custom.xml not found or is corrupted. Using display name as xxxxxx")
  }
  </code></pre>
  
  <p>In windows it works fine but in mac it throws an error in fs.acessSync: The "path" argument must be of type string. Received type undefined.</p>
  
  <p>path.join returns correct path</p>
  
  <p>Output:</p>
  
  <pre><code>/Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/build/bin/darwin/release/custom.xml
  App threw an error during load
  TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
      at validateString (internal/validators.js:105:11)
      at Object.join (path.js:1037:7)
      at eval (webpack:///./src/background.ts?:70:21)
      at Module../src/background.ts (/Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/clouddrive2service/ui/dist_electron/index.js:6094:1)
      at __webpack_require__ (/Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/clouddrive2service/ui/dist_electron/index.js:20:30)
      at eval (webpack:///multi_./src/background.ts?:1:18)
      at Object.0 (/Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/clouddrive2service/ui/dist_electron/index.js:6201:1)
      at __webpack_require__ (/Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/clouddrive2service/ui/dist_electron/index.js:20:30)
      at /Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/clouddrive2service/ui/dist_electron/index.js:84:18
      at Object.&lt;anonymous&gt; (/Users/nikhell/Documents/Codelathe/Workspace/cl-fc-client/clouddrive2service/ui/dist_electron/index.js:87:10)
  </code></pre>
  
  <p>If i remove the file extension it does not throw the error but it is not able to find the file. Why is the file extension creating issues in mac? </p>