title: File access permission in Swift on OSX
body: <p>I'm using:</p>
  
  <pre><code>let dialog = NSOpenPanel()
  </code></pre>
  
  <p>to get a file URL.</p>
  
  <p>I'm then reading in the contents of the text file with:</p>
  
  <pre><code>let content = try String( contentsOf: dialog.url)
  </code></pre>
  
  <p>This works!</p>
  
  <p>I'm then trying to read in another text file in the same directory with a different extension:</p>
  
  <pre><code>let b = dialog.url?.deletingPathExtension()
  // Add the new file extension
  let c = b?.appendingPathExtension("TSN") 
  
  let content2 = try String( contentsOf: c)
  </code></pre>
  
  <p>With this I get:</p>
  
  <p>"The file “FLO5.TSN” couldn’t be opened because you don’t have permission to view it."</p>
  
  <p>If I try and open the .tsn file with a URL from a NSOpenPanel() dialog result it works. I need to open several data files from this same directory with different extensions. Is there a way to do this?</p>