Skip to content

Commit 5b3d8b1

Browse files
committed
fix Error: EEXIST: file already exists
#18
1 parent 6faa677 commit 5b3d8b1

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/class/Metadata.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,9 @@ class Metadata {
7171
const pipelinePath = path.join(userDataPath, 'pipeline', pid, 'metadata');
7272
const filePath = path.join(pipelinePath, filename);
7373
const filePathWithoutName = path.dirname(filePath);
74-
fse.ensureDirSync(filePathWithoutName, '0777');
74+
if(!fse.pathExistsSync(filePathWithoutName)) {
75+
fse.ensureDirSync(filePathWithoutName, '0777');
76+
}
7577
return filePath
7678
}
7779

src/class/SfdcApi.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,9 @@ class SfdcApi {
651651
});
652652
unzipper.on('extract', function (log) {
653653
// console.log('[SFDC]Finished extracting' + log);
654-
fse.ensureDirSync(sourceZipPath, '0777');
654+
if(fse.pathExistsSync(sourceZipPath)) {
655+
fse.removeSync(sourceZipPath);
656+
}
655657
return callback(null, true);
656658
});
657659
unzipper.extract({

0 commit comments

Comments
 (0)