From 5cdbe773c6a89075cceb966474b6d6dba6869cf8 Mon Sep 17 00:00:00 2001 From: Vladimir Matveev Date: Mon, 3 Oct 2016 14:42:06 -0700 Subject: [PATCH] guard against cases when current file name is already in uppercase --- src/compiler/sys.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/compiler/sys.ts b/src/compiler/sys.ts index ed89b9d161..2d4fcd241a 100644 --- a/src/compiler/sys.ts +++ b/src/compiler/sys.ts @@ -316,10 +316,9 @@ namespace ts { if (platform === "win32" || platform === "win64") { return false; } - - const upperCaseFilename = _path.basename(__filename).toUpperCase(); - - return !fileExists(_path.join(_path.dirname(__filename), upperCaseFilename)); + // convert current file name to upper case / lower case and check if file exists + // (guards against cases when name is already all uppercase or lowercase) + return !fileExists(__filename.toUpperCase()) || !fileExists(__filename.toLowerCase()); } const platform: string = _os.platform();