123456789101112131415161718192021 |
- 'use strict'
- const path = require('path')
- module.exports.checkPath = function checkPath (pth) {
- if (process.platform === 'win32') {
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path.parse(pth).root, ''))
- if (pathHasInvalidWinCharacters) {
- const error = new Error(`Path contains invalid characters: ${pth}`)
- error.code = 'EINVAL'
- throw error
- }
- }
- }
|