Skip to content

Commit e07e51e

Browse files
committed
Removes drive path if on windows
1 parent b21b341 commit e07e51e

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/create.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,23 @@
11
import ncp from 'ncp';
22
import path from 'path';
33
import { promisify } from 'util';
4+
import * as os from 'os';
45

56
const copy = promisify(ncp);
67

78
const copyFiles = async (filePath) => {
89

910
try {
1011

12+
let filePath = new URL(import.meta.url).pathname;
13+
14+
if (os.platform() === 'win32') {
15+
// removes the leading drive letter from the path
16+
filePath = filePath.substr(3);
17+
}
18+
1119
const templateDirectory = path.resolve(
12-
new URL(import.meta.url).pathname,
13-
path.join('..', 'templates'),
20+
filePath, '..', 'templates',
1421
);
1522

1623
const targetDirectory = process.cwd();

0 commit comments

Comments
 (0)