Skip to content

getSourceFilePathInNewDir broken by recent commits #9768

@cartant

Description

@cartant

TypeScript Version: 2.0.0-beta

@zhengbli The following commit appears to have broken the getSourceFilePathInNewDir implementation in certain circumstances:

Use getCanonicalFileName

The use of getCanonicalFileName breaks the implementation if the common directory is a parent of the current directory.

For example, with these files:

C:/Users/Nicholas/example/a/a.ts
C:/Users/Nicholas/example/b/b.ts

The common directory is C:/Users/Nicholas/example.

If the current directory is C:/Users/Nicholas/example/b, for the a.ts source file:

cannonical source = ../a/a.ts
cannonical common = ..

So isSourceFileInCommonSourceDirectory will be true.

However, for the b.ts source file:

cannonical source = b.ts
cannonical common = ..

So isSourceFileInCommonSourceDirectory will be false - which will result in the absolute path to the source file - C:/Users/Nicholas/example/b/b.ts - being returned.

Specifically, this change to the implementation breaks my tsify-based builds.

Metadata

Metadata

Assignees

No one assigned

    Labels

    ExternalRelates to another program, environment, or user action which we cannot control.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions