Auto find barotrauma install path function

master
Jaka Perovšek 2024-10-04 00:40:16 +02:00
parent e8ffff4739
commit a3e6c32ae9
2 changed files with 15 additions and 2 deletions

View File

@ -10,12 +10,25 @@ import time
import logging import logging
import certifi import certifi
import math import math
import vdf
from PIL import Image from PIL import Image
from mutagen.oggvorbis import OggVorbis from mutagen.oggvorbis import OggVorbis
from distutils.dir_util import copy_tree from distutils.dir_util import copy_tree
from pathlib import Path from pathlib import Path
def find_install_dir():
library_folders = Path("C:\Program Files (x86)\Steam\steamapps\libraryfolders.vdf")
game_id = "602960"
data = vdf.load(open(library_folders))
install_path = ""
for (id, folder) in data["libraryfolders"].items():
if game_id in folder["apps"]:
install_path = Path(folder["path"]) / Path("steamapps\common\Barotrauma")
return install_path.as_posix()
def download_via_requests(url_source, file_name): def download_via_requests(url_source, file_name):
response = requests.get(url_source, stream=True, verify=certifi.where()) response = requests.get(url_source, stream=True, verify=certifi.where())

View File

@ -6,7 +6,7 @@ import time
from tape_editor_widgets import * from tape_editor_widgets import *
from widgets import LabelWebLink from widgets import LabelWebLink
from deploy import download_ffmpeg, get_ffmpeg_version, download_git from deploy import download_ffmpeg, get_ffmpeg_version, download_git, find_install_dir
from PIL import ImageGrab from PIL import ImageGrab
@ -464,7 +464,7 @@ class InstallWidget(QWidget):
self.install_checkbox = QCheckBox() self.install_checkbox = QCheckBox()
self.install_checkbox.setDisabled(True) self.install_checkbox.setDisabled(True)
self.install_label = QLabel("Copy the files to the install directory") self.install_label = QLabel("Copy the files to the install directory")
self.install_dir = DirWidget() self.install_dir = DirWidget(find_install_dir())
self.install_pushbutton = QPushButton("Install") self.install_pushbutton = QPushButton("Install")
self.grid.addWidget(self.install_checkbox, 40, 0) self.grid.addWidget(self.install_checkbox, 40, 0)
self.grid.addWidget(self.install_label, 40, 1) self.grid.addWidget(self.install_label, 40, 1)