BlueGit

blue-star danique-bot

Files

danique-bot / node_modules / fs-extra / lib / mkdirs / win32.js

win32.js

Import template
timfa Tim · pushed by timfa · 4 years ago
c788ad20 History
win32.js 546 B Download Raw
1'use strict'
2var path = require('path')
3
4// get drive on windows
5function getRootPath (p) {
6 p = path.normalize(path.resolve(p)).split(path.sep)
7 if (p.length > 0) return p[0]
8 else return null
9}
10
11// http://stackoverflow.com/a/62888/10333 contains more accurate
12// TODO: expand to include the rest
13var INVALID_PATH_CHARS = /[<>:"|?*]/
14
15function invalidWin32Path (p) {
16 var rp = getRootPath(p)
17 p = p.replace(rp, '')
18 return INVALID_PATH_CHARS.test(p)
19}
20
21module.exports = {
22 getRootPath: getRootPath,
23 invalidWin32Path: invalidWin32Path
24}