Skip to content

Commit

Permalink
updated gulp
Browse files Browse the repository at this point in the history
  • Loading branch information
amarzavery committed Mar 25, 2017
1 parent 627cad3 commit f52657b
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,20 @@ function getAutorestVersion(version) {
return result;
}

function deleteFolderRecursive(path) {
if (fs.existsSync(path)) {
fs.readdirSync(path).forEach(function (file, index) {
var curPath = path + "/" + file;
if (fs.lstatSync(curPath).isDirectory()) { // recurse
deleteFolderRecursive(curPath);
} else { // delete file
fs.unlinkSync(curPath);
}
});
fs.rmdirSync(path);
}
};

function clearProjectBeforeGenerating(projectDir) {
let modelsDir = `${projectDir}/models`;
let operationsDir = `${projectDir}/operations`;
Expand All @@ -311,7 +325,7 @@ function clearProjectBeforeGenerating(projectDir) {
let filesToBeDeleted = [clientTypedefFile, clientJSFile];
directoriesToBeDeleted.forEach((dir) => {
if (fs.existsSync(dir)) {
fs.rmdirSync(dir);
deleteFolderRecursive(dir);
}
});
filesToBeDeleted.forEach((file) => {
Expand Down

0 comments on commit f52657b

Please sign in to comment.