misc: configurator: Remove acrn config files when selecting a working folder

Instead of removing all .xml and .sh files, just remove:
*.board.xml
scenario.xml
launch*.sh

Tracked-On: #7495
Signed-off-by: Calvin Zhang <calvinzhang.cool@gmail.com>
This commit is contained in:
Calvin Zhang 2022-05-20 11:12:02 +08:00 committed by acrnsi-robot
parent 72054f57fa
commit 8a6445d949
1 changed files with 6 additions and 5 deletions

View File

@ -72,11 +72,12 @@ export default {
.then((r) => {
if (r) {
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') {
let arr = files[i].path.split(window.systemInfo.pathSplit)
let basename = arr[arr.length-1]
console.log("file: ", basename)
if (basename === 'scenario.xml' ||
/^.*\.board\.xml$/.test(basename) ||
/^launch.*\.sh$/.test(basename)) {
console.log("removing: ", files[i].path)
configurator.removeFile(files[i].path)
.catch((err) => alert(`${err}`))