2024-05-08 21:25:00 +00:00
|
|
|
import os
|
|
|
|
import shutil
|
|
|
|
import re
|
|
|
|
|
|
|
|
def resetfun(rdhome):
|
|
|
|
os.system("/app/bin/zypak-wrapper /app/srm/steam-rom-manager list")
|
|
|
|
srm_path=os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/steam-rom-manager/userData/userConfigurations.json")
|
|
|
|
if not os.path.isfile(srm_path):
|
2024-08-28 04:38:37 +00:00
|
|
|
print("Steam ROM Manager configuration not initialized! Initializing now.")
|
2024-05-08 21:25:00 +00:00
|
|
|
shutil.copyfile("/app/libexec/steam-sync/userConfigurations.json", srm_path)
|
2024-09-03 20:16:07 +00:00
|
|
|
shutil.copyfile("/app/libexec/steam-sync/userExceptions.json", srm_path)
|
2024-05-08 21:25:00 +00:00
|
|
|
|
|
|
|
with open(srm_path,"r") as f:
|
|
|
|
data=f.read()
|
|
|
|
data=re.sub("\"steamDirectory.*","\"steamDirectory\" : \""+os.path.expanduser("~/.steam/steam")+"\",",data)
|
|
|
|
data=re.sub("\"romDirectory.*","\"romDirectory\" : \""+rdhome+"/.sync/\",",data)
|
|
|
|
with open(srm_path,"w") as f:
|
|
|
|
f.write(data)
|
|
|
|
|
|
|
|
if __name__=="__main__":
|
|
|
|
rdhome=""
|
|
|
|
|
|
|
|
print("Open RetroDECK config file: {}".format(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg")))
|
|
|
|
|
|
|
|
fl=open(os.path.expanduser("~/.var/app/net.retrodeck.retrodeck/config/retrodeck/retrodeck.cfg"),"r")
|
|
|
|
lines=fl.readlines()
|
|
|
|
for line in lines:
|
|
|
|
if "rdhome" in line:
|
|
|
|
rdhome=line[7:-1]
|
|
|
|
fl.close()
|
|
|
|
|
|
|
|
resetfun(rdhome)
|