mirror of
https://gitlab.com/RemixDev/deemix-js.git
synced 2024-12-28 18:36:26 +00:00
try catch getting music folder from reg registry
This commit is contained in:
parent
8e6c7c1c93
commit
7930ecbc95
|
@ -54,20 +54,22 @@ function getMusicFolder(){
|
|||
musicdata = checkPath(musicdata)
|
||||
}
|
||||
if (process.platform == 'win32' && musicdata === ""){
|
||||
const { execSync } = require('child_process')
|
||||
const musicKeys = ["My Music", "{4BD8D571-6D19-48D3-BE97-422220080E43}"]
|
||||
let regData = execSync('reg.exe query "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"').toString().split('\r\n')
|
||||
for (let i = 0; i < regData.length; i++){
|
||||
let line = regData[i]
|
||||
if (line === "") continue
|
||||
if (i == 1) continue
|
||||
line = line.split(' ')
|
||||
if (musicKeys.includes(line[1])){
|
||||
musicdata = line[3] + sep
|
||||
break;
|
||||
try {
|
||||
const { execSync } = require('child_process')
|
||||
const musicKeys = ["My Music", "{4BD8D571-6D19-48D3-BE97-422220080E43}"]
|
||||
let regData = execSync('reg.exe query "HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders"').toString().split('\r\n')
|
||||
for (let i = 0; i < regData.length; i++){
|
||||
let line = regData[i]
|
||||
if (line === "") continue
|
||||
if (i == 1) continue
|
||||
line = line.split(' ')
|
||||
if (musicKeys.includes(line[1])){
|
||||
musicdata = line[3] + sep
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
musicdata = checkPath(musicdata)
|
||||
musicdata = checkPath(musicdata)
|
||||
} catch {/* empty */}
|
||||
}
|
||||
if (musicdata === ""){
|
||||
musicdata = `${homedata}${sep}Music${sep}`
|
||||
|
|
Loading…
Reference in a new issue