mirror of
https://github.com/angular/angular-cli.git
synced 2025-05-16 18:43:42 +08:00
26 lines
678 B
TypeScript
26 lines
678 B
TypeScript
|
|
/**
|
|
* @license
|
|
* Copyright Google Inc. All Rights Reserved.
|
|
*
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
* found in the LICENSE file at https://angular.io/license
|
|
*/
|
|
// import { relative, Path } from "../../../angular_devkit/core/src/virtual-fs";
|
|
import { Path, basename, dirname, normalize } from '@angular-devkit/core';
|
|
|
|
export interface Location {
|
|
name: string;
|
|
path: Path;
|
|
}
|
|
|
|
export function parseName(path: string, name: string): Location {
|
|
const nameWithoutPath = basename(name as Path);
|
|
const namePath = dirname((path + '/' + name) as Path);
|
|
|
|
return {
|
|
name: nameWithoutPath,
|
|
path: normalize('/' + namePath),
|
|
};
|
|
}
|