From cf276db560a29448bbf2a82ee70a729a76bd0d7e Mon Sep 17 00:00:00 2001 From: SeeLog Date: Fri, 4 Jun 2021 23:58:43 +0900 Subject: [PATCH 1/3] Windows path fix --- src/extension.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/extension.ts b/src/extension.ts index af162f1..35a917c 100644 --- a/src/extension.ts +++ b/src/extension.ts @@ -15,7 +15,8 @@ export function activate(context: vscode.ExtensionContext) { // The code you place here will be executed every time your command is executed const fileController = new FileController(); - const rootPath = vscode.workspace.workspaceFolders?.[0]!.uri.path; + const rootPath = vscode.workspace.workspaceFolders?.[0]!.uri.fsPath.replace(/\\/g, "/"); + if (rootPath !== null && rootPath !== undefined) { const count = await fileController.generateInitFiles(rootPath); vscode.window.showInformationMessage(`Python init Generator: Generate ${count} __init__.py file(s)`); From 5e2e307abe7adb09f4036b71c6dea0d467a34c71 Mon Sep 17 00:00:00 2001 From: SeeLog Date: Fri, 4 Jun 2021 23:59:18 +0900 Subject: [PATCH 2/3] refactor --- src/file-controller.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/file-controller.ts b/src/file-controller.ts index 9cbd363..00179ce 100644 --- a/src/file-controller.ts +++ b/src/file-controller.ts @@ -98,9 +98,10 @@ export class FileController { public async generateInitFile(createDir: string): Promise { let count = 0; - if (!fs.existsSync(path.join(createDir, "__init__.py"))) { + let init_path = path.join(createDir, "__init__.py"); + if (!fs.existsSync(init_path)) { count++; - this.createFile(path.join(createDir, "__init__.py")); + this.createFile(init_path); } return count; From b17220db5b959ce73093901213fc15ff7ecce563 Mon Sep 17 00:00:00 2001 From: SeeLog Date: Sat, 5 Jun 2021 00:12:37 +0900 Subject: [PATCH 3/3] version up --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index bf8d436..517555a 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "python-init-generator", "displayName": "Python init Generator", "description": "Generate Python __init__.py", - "version": "0.0.9", + "version": "0.0.10", "engines": { "vscode": "^1.38.0" },