source: trip-planner-front/node_modules/fs-extra/lib/mkdirs/win32.js@ 6c1585f

Last change on this file since 6c1585f was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 517 bytes
Line 
1'use strict'
2
3const path = require('path')
4
5// get drive on windows
6function getRootPath (p) {
7 p = path.normalize(path.resolve(p)).split(path.sep)
8 if (p.length > 0) return p[0]
9 return null
10}
11
12// http://stackoverflow.com/a/62888/10333 contains more accurate
13// TODO: expand to include the rest
14const INVALID_PATH_CHARS = /[<>:"|?*]/
15
16function invalidWin32Path (p) {
17 const rp = getRootPath(p)
18 p = p.replace(rp, '')
19 return INVALID_PATH_CHARS.test(p)
20}
21
22module.exports = {
23 getRootPath,
24 invalidWin32Path
25}
Note: See TracBrowser for help on using the repository browser.