title: How to change the format of a path string to a different OS?
body: <p>I need to change a file path from MAC to Windows and I was about to just do a simple <code>.replace()</code> of any <code>/</code> with <code>\</code> but it occurred to me that there may be a better way. So for example I need to change:</p>
  <pre><code>foo/bar/file.txt
  </code></pre>
  <p>to:</p>
  <pre><code>foo\bar\file.txt
  </code></pre>