Advertisement
Guest User

Untitled

a guest
May 26th, 2015
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. /**
  2. * Convert slashes in DOS path strings to linux
  3. * @use replace(/\\/g, '/')
  4. *
  5. * And
  6. *
  7. * Replace drive letter and colon with 'cygwin/' then the drive letter
  8. * @use .replace(/^(\w):/i, 'cygwin/$1')
  9. **/
  10. var dir = process.cwd().replace(/\\/g, '/').replace(/^(\w):/i, 'cygwin/$1');
  11.  
  12. /* NOTE: If using in a script, (i.e. not CLI), it is possible to substitute 'process.cwd()'
  13. * With '__dirname'
  14. * Or
  15. * If using 'require('path') then 'path.resolve() will also work
  16. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement