Fix paths on Windows. Closes #171

This commit is contained in:
Kim Biesbjerg 2020-03-21 04:18:07 -07:00
parent e7795c5349
commit 97d844c3d2
4 changed files with 10 additions and 1 deletions

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -0,0 +1 @@
{}

View File

@ -2,6 +2,12 @@ import * as os from 'os';
import * as fs from 'fs'; import * as fs from 'fs';
import * as braces from 'braces'; import * as braces from 'braces';
declare module 'braces' {
interface Options {
keepEscaping?: boolean; // Workaround for option not present in @types/braces 3.0.0
}
}
export function normalizeHomeDir(path: string): string { export function normalizeHomeDir(path: string): string {
if (path.substring(0, 1) === '~') { if (path.substring(0, 1) === '~') {
return `${os.homedir()}/${path.substring(1)}`; return `${os.homedir()}/${path.substring(1)}`;
@ -10,7 +16,7 @@ export function normalizeHomeDir(path: string): string {
} }
export function expandPattern(pattern: string): string[] { export function expandPattern(pattern: string): string[] {
return braces(pattern, { expand: true }); return braces(pattern, { expand: true, keepEscaping: true });
} }
export function normalizePaths(patterns: string[], defaultPatterns: string[] = []): string[] { export function normalizePaths(patterns: string[], defaultPatterns: string[] = []): string[] {