Skip to content

Commit

Permalink
#778: ensure old folder structures in retrieve folder are removed upo…
Browse files Browse the repository at this point in the history
…n re-retrieve
  • Loading branch information
JoernBerkefeld committed Mar 10, 2023
1 parent 0592ebf commit 64a6830
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ class Mcdev {
cache.initCache(buObject);
cred = buObject.credential;
bu = buObject.businessUnit;
// clean up old folders after types were renamed
// TODO: Remove this with version 5.0.0
const renamedTypes = {
triggeredSend: 'triggeredSendDefinition',
};
Util.logger.info(`\n :: Retrieving ${cred}/${bu}\n`);
const retrieveTypesArr = [];
if (selectedTypesArr) {
Expand All @@ -243,6 +248,18 @@ class Mcdev {
if (!keys) {
// dont delete directories if we are just re-retrieving a single file
await File.remove(File.normalizePath(removePathArr));
// clean up old folders after types were renamed
// TODO: Remove this with version 5.0.0
if (renamedTypes[type]) {
await File.remove(
File.normalizePath([
properties.directories.retrieve,
cred,
bu,
renamedTypes[type],
])
);
}
}
}
}
Expand Down

0 comments on commit 64a6830

Please sign in to comment.