替换程序中所有同步API的调用
This commit is contained in:
@@ -262,9 +262,9 @@ export default {
|
||||
this.handleStartTask(index)
|
||||
}
|
||||
},
|
||||
handlePlay(index) {
|
||||
async handlePlay(index) {
|
||||
const targetSong = this.list[index]
|
||||
if (!checkPath(path.join(this.setting.download.savePath, targetSong.fileName))) return
|
||||
if (!await checkPath(path.join(this.setting.download.savePath, targetSong.fileName))) return
|
||||
this.setList({ list: this.list, listId: 'download', index: this.list.findIndex(i => i.key === targetSong.key) })
|
||||
},
|
||||
handleListBtnClick(info) {
|
||||
@@ -333,9 +333,9 @@ export default {
|
||||
}
|
||||
this.removeAllSelect()
|
||||
},
|
||||
handleOpenFolder(index) {
|
||||
async handleOpenFolder(index) {
|
||||
let path = this.list[index].filePath
|
||||
if (!checkPath(path)) return
|
||||
if (!await checkPath(path)) return
|
||||
openDirInExplorer(path)
|
||||
},
|
||||
handleSearch(index) {
|
||||
|
||||
@@ -413,10 +413,10 @@ export default {
|
||||
handleOpenDir(dir) {
|
||||
openDirInExplorer(dir)
|
||||
},
|
||||
importSetting(path) {
|
||||
async importSetting(path) {
|
||||
let settingData
|
||||
try {
|
||||
settingData = JSON.parse(fs.readFileSync(path, 'utf8'))
|
||||
settingData = JSON.parse(await fs.promises.readFile(path, 'utf8'))
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
@@ -435,10 +435,10 @@ export default {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
importPlayList(path) {
|
||||
async importPlayList(path) {
|
||||
let listData
|
||||
try {
|
||||
listData = JSON.parse(fs.readFileSync(path, 'utf8'))
|
||||
listData = JSON.parse(await fs.promises.readFile(path, 'utf8'))
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
@@ -465,10 +465,10 @@ export default {
|
||||
console.log(err)
|
||||
})
|
||||
},
|
||||
importAllData(path) {
|
||||
async importAllData(path) {
|
||||
let allData
|
||||
try {
|
||||
allData = JSON.parse(fs.readFileSync(path, 'utf8'))
|
||||
allData = JSON.parse(await fs.promises.readFile(path, 'utf8'))
|
||||
} catch (error) {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user