提交 60713ed9 编写于 作者: J Joao Moreno

mkdirp: don't try to create fs roots

fixes #379
上级 fc6faebb
......@@ -10,9 +10,12 @@ import extfs = require('vs/base/node/extfs');
import paths = require('vs/base/common/paths');
import { dirname, join } from 'path';
import { nfcall } from 'vs/base/common/async';
import fs = require('fs');
export function isRoot(path: string): boolean {
return path === dirname(path);
}
export function readdir(path: string): TPromise<string[]> {
return nfcall(extfs.readdir, path);
}
......@@ -38,6 +41,10 @@ export function mkdirp(path: string, mode?: number): TPromise<boolean> {
return TPromise.wrapError<boolean>(err);
});
if (isRoot(path)) {
return TPromise.as(true);
}
return mkdir().then(null, (err: NodeJS.ErrnoException) => {
if (err.code === 'ENOENT') {
return mkdirp(dirname(path), mode).then(mkdir);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册