Skip to content

Commit 80f3cdb

Browse files
committed
fix mdl error and 0.5.1
1 parent f3529fe commit 80f3cdb

File tree

2 files changed

+26
-21
lines changed

2 files changed

+26
-21
lines changed

_vpk.py

Lines changed: 25 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -143,14 +143,20 @@ def extract_and_open_file_in_vpk(self, file_name):
143143
temp_dir = tempfile.mkdtemp()
144144

145145
def extract_file(path):
146-
pakfile = self.vpk_file.get_file(path)
147-
if pakfile:
148-
file_content = pakfile.read()
149-
temp_file_path = os.path.join(temp_dir, os.path.basename(path))
150-
with open(temp_file_path, 'wb') as temp_file:
151-
temp_file.write(file_content)
152-
return temp_file_path
153-
return None
146+
try:
147+
pakfile = self.vpk_file.get_file(path)
148+
if pakfile:
149+
file_content = pakfile.read()
150+
temp_file_path = os.path.join(temp_dir, os.path.basename(path))
151+
with open(temp_file_path, 'wb') as temp_file:
152+
temp_file.write(file_content)
153+
return temp_file_path
154+
else:
155+
print(f"File {path} not found in VPK.")
156+
return None
157+
except KeyError:
158+
print(f"KeyError: {path} does not exist in the VPK archive.")
159+
return None
154160

155161
# Extract the primary file
156162
primary_temp_path = extract_file(file_name)
@@ -163,18 +169,17 @@ def extract_file(path):
163169
base_name = os.path.splitext(file_name)[0]
164170
related_files = []
165171
for ext in related_extensions:
166-
try:
167-
related_temp_path = extract_file(base_name + ext)
168-
if related_temp_path:
169-
related_files.append(related_temp_path)
170-
except OSError:
171-
print("mdl error")
172-
173-
# Ensure all required files are present
174-
if len(related_files) != len(related_extensions):
175-
print(f"Missing related files for {file_name}.")
176-
return
177-
172+
related_temp_path = extract_file(base_name + ext)
173+
if related_temp_path:
174+
related_files.append(related_temp_path)
175+
176+
""""
177+
# Ensure all required files are present
178+
if len(related_files) != len(related_extensions):
179+
print(f"Missing related files for {file_name}.")
180+
return
181+
"""
182+
178183
# Open the file with the appropriate application
179184
file_name, file_extension = os.path.splitext(primary_temp_path)
180185

assetsBrowser.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ def open_file_explorer(self):
472472
repo_name = "SourceSDK-"
473473

474474
# Replace this with the version of your local software
475-
local_version = "0.5.0"
475+
local_version = "0.5.1"
476476

477477
github_version = test.get_latest_release_version(repo_owner, repo_name)
478478

0 commit comments

Comments
 (0)