Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit 79286a6

Browse files
committed
Fix a crash on uninstall if target file doesn't exist.
1 parent 62206fb commit 79286a6

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

Diff for: installer.js

+9-4
Original file line numberDiff line numberDiff line change
@@ -232,8 +232,7 @@ function copyProjectTemplate(templateName, projectPath) {
232232

233233
function deleteProjectFile(projectPath) {
234234
var destinationPath = path.join(projectDir, projectPath);
235-
console.log("Deleting file: " + destinationPath);
236-
fs.unlink(destinationPath);
235+
deleteFile(destinationPath);
237236
}
238237

239238
function copyAppTemplate(templateName, appPath) {
@@ -243,8 +242,14 @@ function copyAppTemplate(templateName, appPath) {
243242

244243
function deleteAppFile(appPath) {
245244
var destinationPath = path.join(appDir, appPath);
246-
console.log("Deleting file: " + destinationPath);
247-
fs.unlink(destinationPath);
245+
deleteFile(destinationPath);
246+
}
247+
248+
function deleteFile(destinationPath) {
249+
if (fs.existsSync(destinationPath)) {
250+
console.log("Deleting file: " + destinationPath);
251+
fs.unlink(destinationPath);
252+
}
248253
}
249254

250255
function copyTemplate(templateName, destinationPath) {

0 commit comments

Comments
 (0)