Skip to content

ng generate on Windows do not interpret correctly the path separator #11501

Closed
@pjmolina

Description

@pjmolina

Bug Report

- [x] bug report

Area

- [?] devkit
- [?] schematics

Versions

Angular CLI: 6.0.8
Node: 10.4.1
OS: win32 x64 / Windows 10
Angular: 6.0.7

Repro steps

ng generate service services\Session

The log given by the failure

No log provided.

Desired functionality

Generated file should look like:

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class SessionService {
  constructor() {
  }
}

but it contains:

import { Injectable } from '@angular/core';

@Injectable({
  providedIn: 'root'
})
export class services\SessionService {
  constructor() {
  }
}

Note the services\SessionService identifier instead SessionService.
The '\' symbol is the path separator on windows.
This used to work on previous versions of CLI.

Mention any other details that might be useful

  • ng generate service services/Session works as expected.
  • ng generate service services\Session fails in the described way.
  • Files are generated on the expected locations and with expected names.
  • Content of files is not ok as described.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions