Merge pull request #11029 from Microsoft/fix-write-file

add check if expected directory path is non-empty string
This commit is contained in:
Vladimir Matveev 2016-09-21 10:20:08 -07:00 committed by GitHub
commit dd77c8c139

View file

@ -611,7 +611,7 @@ namespace ts {
const originalWriteFile = sys.writeFile;
sys.writeFile = function(path, data, writeBom) {
const directoryPath = getDirectoryPath(normalizeSlashes(path));
if (!sys.directoryExists(directoryPath)) {
if (directoryPath && !sys.directoryExists(directoryPath)) {
recursiveCreateDirectory(directoryPath, sys);
}
originalWriteFile.call(sys, path, data, writeBom);