Skip to content

Commit

Permalink
Fix incorrect .vscode directory creation inside Tizen projects
Browse files Browse the repository at this point in the history
IoT.js-VSCode-DCO-1.0-Signed-off-by: Tibor Dusnoki [email protected]
  • Loading branch information
tdusnoki authored and yichoi committed Sep 21, 2018
1 parent 3ba99c4 commit 8e5cab4
Showing 1 changed file with 9 additions and 20 deletions.
29 changes: 9 additions & 20 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,30 +96,19 @@ const createTizenProject = async() => {
canSelectMany: false
});
if (projectPath) {
const createProject = Cp.execFile(createPath, [projectName, projectPath[0].path, tizenStudioPath]);
createProject.stdout.on('data', createLog => {
console.log(createLog.toString());
});
createProject.stderr.on('data', errorLog => {
console.log(errorLog.toString());
});
fs.mkdir(`${projectPath[0].path}/.vscode`, (err) => {
if (err) {
vscode.window.showErrorMessage(err.message);
return;
}
});
fs.copyFile(lastModified.filePath, `${projectPath[0].path}/.vscode/launch.json`, (err) => {
if (err) {
vscode.window.showErrorMessage(err.message);
return;
}
});
vscode.commands.executeCommand('vscode.openFolder', projectPath[0], true);
Cp.execFileSync(createPath, [projectName, projectPath[0].path, tizenStudioPath]);
openProject(projectPath[0].path, projectName);
}
}
};

const openProject = (path: string, name: string) => {
const project = vscode.Uri.file(`${path}/${name}`);
fs.mkdirSync(`${project.path}/.vscode`);
fs.copyFileSync(lastModified.filePath, `${project.path}/.vscode/launch.json`);
vscode.commands.executeCommand('vscode.openFolder', project, true);
};

const walkSync = (dir: string, filelist: string[] = []): string[] => {
fs.readdirSync(dir).forEach(file => {
filelist = fs.statSync(path.join(dir, file)).isDirectory()
Expand Down

0 comments on commit 8e5cab4

Please sign in to comment.