This commit is contained in:
faroukbmiled 2023-07-31 19:45:46 +01:00
parent e73ce4ac15
commit dc2bfebc03

View File

@ -4,6 +4,7 @@ import subprocess
import configparser import configparser
import filecmp import filecmp
import json import json
import shutil
import psutil import psutil
import requests import requests
import time import time
@ -52,10 +53,20 @@ def run_steamcmd_command(command):
global steampid global steampid
steampid = process.pid steampid = process.pid
while True: for output in process.stdout:
output = process.stdout.readline().rstrip() output = output.rstrip()
if output.strip():
print(output)
if process.poll() is not None: if process.poll() is not None:
break return process.returncode
process.communicate()
if process.returncode != 0:
show_message("Warning", "SteamCMD encountered an error while downloading, try again!")
return process.returncode
def get_steamcmd_path(): def get_steamcmd_path():
config = configparser.ConfigParser() config = configparser.ConfigParser()
@ -158,17 +169,11 @@ def download_workshop_map(workshop_id, destination_folder, progress_bar, speed_l
return return
os.makedirs(folder_name_path, exist_ok=True) os.makedirs(folder_name_path, exist_ok=True)
map_files = os.listdir(map_folder)
for map_file in map_files: try:
source_path = os.path.join(map_folder, map_file) shutil.copytree(map_folder, folder_name_path, dirs_exist_ok=True)
destination_path = os.path.join(folder_name_path, map_file) except Exception as E:
print(f"Error copying files: {E}")
if os.path.exists(destination_path) and filecmp.cmp(source_path, destination_path):
pass
else:
os.replace(source_path, destination_path)
QCoreApplication.processEvents()
show_message("Download Complete", f"{mod_type} files are downloaded at {folder_name_path}") show_message("Download Complete", f"{mod_type} files are downloaded at {folder_name_path}")