Skip to content

Join Paths Produces Incorrect Result When Passing in Path via Command Line #24

@jon49

Description

@jon49

These two work properly (note that there is a proposed solution at the bottom):

typson schema ./api/users.ts
typson schema api/users.ts

These produce errors:

typson schema .\api\users.ts
typson schema api\users.ts

Errors:

typson : { [Error: ENOENT, open 'C:\Users\1198462\Source\Repos\mobiledlr\mobiledlr\api\users.ts\common\mco-list.ts']
At line:2 char:1
+ typson schema api\users.ts
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: ({ [Error: ENOEN...n\mco-list.ts']:String) [], RemoteException
    + FullyQualifiedErrorId : NativeCommandError

  errno: 34,
  code: 'ENOENT',
  path: 'C:\\Users\\1198462\\Source\\Repos\\mobiledlr\\mobiledlr\\api\\users.ts\\common\\mco-list.ts' }
...
...
...
{ [Error: ENOENT, open 'C:\Users\1198462\Source\Repos\mobiledlr\mobiledlr\api\users.ts\common\user.ts']
  errno: 34,
  code: 'ENOENT',
  path: 'C:\\Users\\1198462\\Source\\Repos\\mobiledlr\\mobiledlr\\api\\users.ts\\common\\user.ts' }
api/users.ts: error TS2095: Could not find symbol 'User'.
api/users.ts: error TS2095: Could not find symbol 'McoList'.

I'm guessing that the error comes from the function fullModulePath - but I haven't looked into that deeply. I propose either using node's path (probably not since this is used in the browser also) or do something like the following:

var s = '.\\as\\asf.ts'
s.replace(/\\/g, '/')

Let me know if you would like a pull request.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions