mirror of
https://github.com/derrod/legendary.git
synced 2025-08-27 12:21:00 +00:00
Other vars.
Is path correct
This commit is contained in:
parent
90f2ab5e90
commit
f3eec9cc41
|
@ -364,6 +364,7 @@ class LegendaryCLI:
|
||||||
|
|
||||||
logger.warning('Path contains unprocessed variables')
|
logger.warning('Path contains unprocessed variables')
|
||||||
if get_boolean_choice("Path contains variables, Do you want to import it automatically"):
|
if get_boolean_choice("Path contains variables, Do you want to import it automatically"):
|
||||||
|
|
||||||
# Import automatically
|
# Import automatically
|
||||||
|
|
||||||
# find Wineprefix
|
# find Wineprefix
|
||||||
|
@ -372,40 +373,39 @@ class LegendaryCLI:
|
||||||
wine_prefix = self.core.lgd.config.get(igame.app_name, "wine_prefix")
|
wine_prefix = self.core.lgd.config.get(igame.app_name, "wine_prefix")
|
||||||
elif "wine_prefix" in self.core.lgd.config["Legendary"]:
|
elif "wine_prefix" in self.core.lgd.config["Legendary"]:
|
||||||
wine_prefix = self.core.lgd.config.get("Legendary", "wine_prefix")
|
wine_prefix = self.core.lgd.config.get("Legendary", "wine_prefix")
|
||||||
|
# Use default wineprefix
|
||||||
else:
|
else:
|
||||||
wine_prefix = os.path.expanduser("~/.wine")
|
wine_prefix = os.path.expanduser("~/.wine")
|
||||||
|
|
||||||
if len(save_path.split("%")) > 3:
|
if len(save_path.split("%")) > 3:
|
||||||
logger.warning("Path has more than two Variables. It is not supported yet")
|
logger.warning("Path has more than two Variables. It is not supported yet")
|
||||||
return
|
return
|
||||||
|
|
||||||
# Environment variable
|
# Environment variable
|
||||||
var = save_path.split("%")[1]
|
var = save_path.split("%")[1]
|
||||||
|
with open(os.path.join(wine_prefix, "user.reg")) as reg_file:
|
||||||
|
import re
|
||||||
|
for i in reg_file:
|
||||||
|
if bool(re.match(f"\"{var}\"=", i, re.I)):
|
||||||
|
appdata_path = i.split("=")[1]
|
||||||
|
appdata_path = appdata_path.replace("\\\\", "/").replace("C:", "").replace("\"",
|
||||||
|
"").replace(
|
||||||
|
"\n", "")
|
||||||
|
reg_file.close()
|
||||||
|
break
|
||||||
|
|
||||||
if var == "APPDATA":
|
# Found variable :D
|
||||||
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", "")
|
|
||||||
break
|
|
||||||
|
|
||||||
else:
|
|
||||||
logger.error("No Appdata found in user.reg")
|
|
||||||
return
|
|
||||||
else:
|
|
||||||
logger.warning(f"Variable {var} not supported")
|
|
||||||
return
|
|
||||||
|
|
||||||
save_path = save_path.split("%")[2]
|
save_path = save_path.split("%")[2]
|
||||||
save_path = wine_prefix + "/drive_c" + appdata_path + save_path
|
save_path = wine_prefix + "/drive_c" + appdata_path + save_path
|
||||||
|
|
||||||
# this doesn't work. Idk
|
# this doesn't work. Idk
|
||||||
# save_path = os.path.join(wine_prefix, "drive_c", appdata_path, save_path)
|
# save_path = os.path.join(wine_prefix, "drive_c", appdata_path, save_path)
|
||||||
|
|
||||||
logger.info("Savepath: " + save_path)
|
if appdata_path and get_boolean_choice(f"Is this path right? '{save_path}'"):
|
||||||
yn = True
|
yn = True
|
||||||
|
|
||||||
|
else:
|
||||||
|
yn = False
|
||||||
|
|
||||||
else:
|
else:
|
||||||
logger.warning("Please insert path manually")
|
logger.warning("Please insert path manually")
|
||||||
yn = False
|
yn = False
|
||||||
|
|
Loading…
Reference in a new issue