title: Swift 3 Read Terminal Current Working Directory
body: <p>I want to develop an app to promote the experience when using terminal on Mac. And I want to get the current working directory (cwd) from terminal. How can I implement it?</p>
  
  <p>I notice that the answer in <a href="https://stackoverflow.com/questions/29514738/get-terminal-output-after-a-command-swift">Get terminal output after a command swift</a> is really good but it seems that it still cannot resolve my problem perfectly. I learned <code>Process().currentDirectoryPath</code> from Apple's document <a href="https://developer.apple.com/reference/foundation/process" rel="noreferrer">https://developer.apple.com/reference/foundation/process</a> Does it do the trick that I need? Can I use it like the following?</p>
  
  <pre><code>let path = Process().currentDirectoryPath
  </code></pre>
  
  <p>I am very new to swift and Xcode, please help me! Thanks!</p>
  
  <hr>
  
  <p>Update: Thank you guys! It seems that both</p>
  
  <pre><code>let path = fileManager.default.currentDirectoryPath
  </code></pre>
  
  <p>and the <code>Process()</code> one temporarily work for me. Are there any differences between these two?</p>