Small bugfixes

This commit is contained in:
Dummerle 2020-12-14 20:25:02 +01:00
parent 2c266675b8
commit 90f2ab5e90

View file

@ -362,8 +362,11 @@ class LegendaryCLI:
if '%' in save_path or '{' in save_path:
logger.warning('Path contains unprocessed variables, Do you want to import them automatically')
logger.warning('Path contains unprocessed variables')
if get_boolean_choice("Path contains variables, Do you want to import it automatically"):
# Import automatically
# find Wineprefix
if igame.app_name in self.core.lgd.config.sections() and "wine_prefix" in self.core.lgd.config[
igame.app_name]:
wine_prefix = self.core.lgd.config.get(igame.app_name, "wine_prefix")
@ -375,13 +378,17 @@ class LegendaryCLI:
if len(save_path.split("%")) > 3:
logger.warning("Path has more than two Variables. It is not supported yet")
return
# Environment variable
var = save_path.split("%")[1]
if var == "APPDATA":
for i in open(os.path.join(wine_prefix, "user.reg")):
with open(os.path.join(wine_prefix, "user.reg")) as reg_file:
for i in reg_file:
if i.startswith("\"AppData\"="):
appdata_path = i.split("=")[1]
appdata_path = appdata_path.replace("\\\\", "/").replace("C:", "").replace("\"","").replace("\n", "")
appdata_path = appdata_path.replace("\\\\", "/").replace("C:", "").replace("\"",
"").replace(
"\n", "")
break
else:
@ -392,10 +399,9 @@ class LegendaryCLI:
return
save_path = save_path.split("%")[2]
save_path = wine_prefix + "/drive_c" + appdata_path + save_path
# idk. this doesn't work
# this doesn't work. Idk
# save_path = os.path.join(wine_prefix, "drive_c", appdata_path, save_path)
logger.info("Savepath: " + save_path)