Skip to content

Commit 8e5cab4

Browse files
tdusnokiyichoi
authored andcommitted
Fix incorrect .vscode directory creation inside Tizen projects
IoT.js-VSCode-DCO-1.0-Signed-off-by: Tibor Dusnoki [email protected]
1 parent 3ba99c4 commit 8e5cab4

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

src/extension.ts

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -96,30 +96,19 @@ const createTizenProject = async() => {
9696
canSelectMany: false
9797
});
9898
if (projectPath) {
99-
const createProject = Cp.execFile(createPath, [projectName, projectPath[0].path, tizenStudioPath]);
100-
createProject.stdout.on('data', createLog => {
101-
console.log(createLog.toString());
102-
});
103-
createProject.stderr.on('data', errorLog => {
104-
console.log(errorLog.toString());
105-
});
106-
fs.mkdir(`${projectPath[0].path}/.vscode`, (err) => {
107-
if (err) {
108-
vscode.window.showErrorMessage(err.message);
109-
return;
110-
}
111-
});
112-
fs.copyFile(lastModified.filePath, `${projectPath[0].path}/.vscode/launch.json`, (err) => {
113-
if (err) {
114-
vscode.window.showErrorMessage(err.message);
115-
return;
116-
}
117-
});
118-
vscode.commands.executeCommand('vscode.openFolder', projectPath[0], true);
99+
Cp.execFileSync(createPath, [projectName, projectPath[0].path, tizenStudioPath]);
100+
openProject(projectPath[0].path, projectName);
119101
}
120102
}
121103
};
122104

105+
const openProject = (path: string, name: string) => {
106+
const project = vscode.Uri.file(`${path}/${name}`);
107+
fs.mkdirSync(`${project.path}/.vscode`);
108+
fs.copyFileSync(lastModified.filePath, `${project.path}/.vscode/launch.json`);
109+
vscode.commands.executeCommand('vscode.openFolder', project, true);
110+
};
111+
123112
const walkSync = (dir: string, filelist: string[] = []): string[] => {
124113
fs.readdirSync(dir).forEach(file => {
125114
filelist = fs.statSync(path.join(dir, file)).isDirectory()

0 commit comments

Comments
 (0)