misc: configurator: remove config files when choosing a working folder

Instead of deleting all files, just remove xml and launch scripts.

Tracked-On: #7495
Signed-off-by: Calvin Zhang <calvinzhang.cool@gmail.com>
This commit is contained in:
Calvin Zhang 2022-05-17 17:47:51 +08:00 committed by acrnsi-robot
parent 5c72036a67
commit a8a9b2f40a

View File

@ -68,17 +68,25 @@ export default {
.then((files) => { .then((files) => {
console.log("Directory exists.", files) console.log("Directory exists.", files)
if (files.length > 0) { if (files.length > 0) {
confirm(`Warning: all existing files in the following working folder will be deleted: \n${folderPath}`) confirm(`Warning: delete previous config files in the following working folder: \n${folderPath}?`)
.then((r) => { .then((r) => {
if (r) { if (r) {
configurator.removeDir(folderPath) for (let i = 0; i < files.length; i++) {
.then(()=> { console.log("file: ", files[i].path)
configurator.creatDir(folderPath) let arr = files[i].path.split('.')
this.nextPage(folderPath) let suffix = arr[arr.length - 1]
}) console.log("suffix:", suffix)
.catch((err) => alert(`${err}`)) if (suffix == 'sh' || suffix == 'xml') {
console.log("removing: ", files[i].path)
configurator.removeFile(files[i].path)
.catch((err) => alert(`${err}`))
}
}
} }
}) })
.then(() => {
this.nextPage(folderPath)
})
} else { } else {
this.nextPage(folderPath) this.nextPage(folderPath)
} }