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) => {
console.log("Directory exists.", files)
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) => {
if (r) {
configurator.removeDir(folderPath)
.then(()=> {
configurator.creatDir(folderPath)
this.nextPage(folderPath)
})
.catch((err) => alert(`${err}`))
for (let i = 0; i < files.length; i++) {
console.log("file: ", files[i].path)
let arr = files[i].path.split('.')
let suffix = arr[arr.length - 1]
console.log("suffix:", suffix)
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 {
this.nextPage(folderPath)
}