Skip to content
This repository was archived by the owner on Aug 15, 2024. It is now read-only.

Commit d10cc72

Browse files
committed
normalize path before perform any action with fs
1 parent fe762d8 commit d10cc72

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

lib/MemoryFileSystem.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
MIT License http://www.opensource.org/licenses/mit-license.php
33
Author Tobias Koppers @sokra
44
*/
5+
6+
var normalize = require('path').normalize;
7+
58
function MemoryFileSystem(data) {
69
this.data = data || {};
710
}
@@ -18,6 +21,7 @@ function isFile(item) {
1821
}
1922

2023
function pathToArray(path) {
24+
path = normalize(path);
2125
var nix = /^\//.test(path);
2226
if(!nix) {
2327
if(!/^[A-Za-z]:/.test(path)) throw new Error("Invalid path '" + path + "'");

0 commit comments

Comments
 (0)