a zip code crypto-currency system good for red ONLY

win32.js 517B

1234567891011121314151617181920212223242526
  1. 'use strict'
  2. const path = require('path')
  3. // get drive on windows
  4. function getRootPath (p) {
  5. p = path.normalize(path.resolve(p)).split(path.sep)
  6. if (p.length > 0) return p[0]
  7. return null
  8. }
  9. // http://stackoverflow.com/a/62888/10333 contains more accurate
  10. // TODO: expand to include the rest
  11. const INVALID_PATH_CHARS = /[<>:"|?*]/
  12. function invalidWin32Path (p) {
  13. const rp = getRootPath(p)
  14. p = p.replace(rp, '')
  15. return INVALID_PATH_CHARS.test(p)
  16. }
  17. module.exports = {
  18. getRootPath,
  19. invalidWin32Path
  20. }