Skip to content

Ignore drive letters when comparing casings of the files with forceConsistentCasingInFileNames - #31503

Merged
Sheetal Nandi (sheetalkamat) merged 1 commit into
masterfrom
casing
May 22, 2019
Merged

Ignore drive letters when comparing casings of the files with forceConsistentCasingInFileNames#31503
Sheetal Nandi (sheetalkamat) merged 1 commit into
masterfrom
casing

Conversation

@sheetalkamat

Copy link
Copy Markdown
Member

Fixes #31327

Comment thread src/compiler/utilities.ts

function getPathWithoutRoot(pathComponents: ReadonlyArray<string>) {
if (pathComponents.length === 0) return "";
return pathComponents.slice(1).join(directorySeparator);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So pathComponents[0] is always / on *nix systems, and e.g. C:/ on Windows, right?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

@mihailik mihailik left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like a bug?

Comment thread src/compiler/program.ts
inputName = getProjectReferenceRedirect(fileName) || fileName;
}
if (getNormalizedAbsolutePath(checkedName, currentDirectory) !== getNormalizedAbsolutePath(inputName, currentDirectory)) {
// Check if it differs only in drive letters its ok to ignore that error:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it??

C:\file is indeed the same as c:\file — but it is most definitely NOT the same as D:\file.

Looking at the use below the code will wrongly assume C:\file match D:\file.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's guaranteed to be match because the file was found by its name.

@microsoft Microsoft (microsoft) locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

forceConsistentCasingInFileNames shouldn't compare drive letters

3 participants