Files

35 lines
1.2 KiB
Python
Raw Permalink Normal View History

2021-07-18 10:33:08 +02:00
import os
import re
2021-12-06 05:20:37 -06:00
from PyQt6.QtCore import QDir
2021-07-18 10:33:08 +02:00
from ..basic_game import BasicGame
class MSFS2020Game(BasicGame):
Name = "Microsoft Flight Simulator 2020 Support Plugin"
Author = "Deorder"
Version = "0.0.1"
GameName = "Microsoft Flight Simulator 2020"
GameShortName = "msfs2020"
GameBinary = r"FlightSimulator.exe"
GameSteamId = [1250410]
2021-12-27 00:57:18 -07:00
GameSupportURL = (
r"https://github.com/ModOrganizer2/modorganizer-basic_games/wiki/"
"Game:-Microsoft-Flight-Simulator-(2020)"
)
def dataDirectory(self) -> QDir:
2021-03-10 20:27:23 +01:00
# Find and use package path specified in Asobo engine options
AppDataPath = os.path.expandvars(r"%APPDATA%\Microsoft Flight Simulator")
UserCfgPath = os.path.join(AppDataPath, "UserCfg.opt")
2021-03-10 20:27:23 +01:00
InstalledPackagesPathPattern = re.compile(
r'InstalledPackagesPath\s*=\s*"(.*)"', re.IGNORECASE
2021-03-10 20:27:23 +01:00
)
with open(UserCfgPath, newline="") as f:
for _, line in enumerate(f):
for match in re.finditer(InstalledPackagesPathPattern, line):
return QDir(os.path.join(match.group(), "Community"))
return QDir(os.path.join(AppDataPath, "Packages", "Community"))