added delete zip files code (#16230)

* added delete zip files code

* removed space
This commit is contained in:
Alex Ma
2021-07-16 12:21:23 -07:00
committed by GitHub
parent 78a144b5ca
commit f53a06a403
2 changed files with 16 additions and 4 deletions

View File

@@ -353,6 +353,11 @@ function renameVscodeLangpacks() {
console.log('vscode pack is not in ADS yet: ' + langId);
continue;
}
//Delete any erroneous zip files found in vscode folder.
let globZipArray = glob.sync(path.join(locVSCODEFolder, '*.zip'));
globZipArray.forEach(element => {
fs.unlinkSync(element);
});
// Delete extension files in vscode language pack that are not in ADS.
if (fs.existsSync(translationDataFolder)) {
let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions'));
@@ -366,9 +371,9 @@ function renameVscodeLangpacks() {
}
}
//Get list of md files in ADS langpack, to copy to vscode langpack prior to renaming.
let globArray = glob.sync(path.join(locADSFolder, '*.md'));
let globMDArray = glob.sync(path.join(locADSFolder, '*.md'));
//Copy files to vscode langpack, then remove the ADS langpack, and finally rename the vscode langpack to match the ADS one.
globArray.forEach(element => {
globMDArray.forEach(element => {
fs.copyFileSync(element, path.join(locVSCODEFolder, path.parse(element).base));
});
rimraf.sync(locADSFolder);

View File

@@ -375,6 +375,13 @@ export function renameVscodeLangpacks(): Promise<void> {
console.log('vscode pack is not in ADS yet: ' + langId);
continue;
}
//Delete any erroneous zip files found in vscode folder.
let globZipArray = glob.sync(path.join(locVSCODEFolder, '*.zip'));
globZipArray.forEach(element => {
fs.unlinkSync(element);
});
// Delete extension files in vscode language pack that are not in ADS.
if (fs.existsSync(translationDataFolder)) {
let totalExtensions = fs.readdirSync(path.join(translationDataFolder, 'extensions'));
@@ -389,10 +396,10 @@ export function renameVscodeLangpacks(): Promise<void> {
}
//Get list of md files in ADS langpack, to copy to vscode langpack prior to renaming.
let globArray = glob.sync(path.join(locADSFolder, '*.md'));
let globMDArray = glob.sync(path.join(locADSFolder, '*.md'));
//Copy files to vscode langpack, then remove the ADS langpack, and finally rename the vscode langpack to match the ADS one.
globArray.forEach(element => {
globMDArray.forEach(element => {
fs.copyFileSync(element, path.join(locVSCODEFolder,path.parse(element).base));
});
rimraf.sync(locADSFolder);