try catch getting music folder from reg registry
This commit is contained in:
parent
8be934fb42
commit
6a6ec400db
|
@ -52,6 +52,7 @@ def getMusicFolder():
|
||||||
musicdata = Path(os.path.expandvars(musicdata))
|
musicdata = Path(os.path.expandvars(musicdata))
|
||||||
musicdata = checkPath(musicdata)
|
musicdata = checkPath(musicdata)
|
||||||
if os.name == 'nt' and musicdata == "":
|
if os.name == 'nt' and musicdata == "":
|
||||||
|
try:
|
||||||
musicKeys = ['My Music', '{4BD8D571-6D19-48D3-BE97-422220080E43}']
|
musicKeys = ['My Music', '{4BD8D571-6D19-48D3-BE97-422220080E43}']
|
||||||
regData = os.popen(r'reg.exe query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"').read().split('\r\n')
|
regData = os.popen(r'reg.exe query "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders"').read().split('\r\n')
|
||||||
for i, line in enumerate(regData):
|
for i, line in enumerate(regData):
|
||||||
|
@ -62,6 +63,8 @@ def getMusicFolder():
|
||||||
musicdata = Path(line[3])
|
musicdata = Path(line[3])
|
||||||
break
|
break
|
||||||
musicdata = checkPath(musicdata)
|
musicdata = checkPath(musicdata)
|
||||||
|
except Exception:
|
||||||
|
musicdata = ""
|
||||||
if musicdata == "":
|
if musicdata == "":
|
||||||
musicdata = homedata / 'Music'
|
musicdata = homedata / 'Music'
|
||||||
musicdata = checkPath(musicdata)
|
musicdata = checkPath(musicdata)
|
||||||
|
|
Loading…
Reference in New Issue