Skip to content

Commit 03b9fa4

Browse files
committed
Fix the extract_icon() function to extract the right icon when a resource ID is provided instead of an index
1 parent 15a69ac commit 03b9fa4

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

utils/icon.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,14 @@ def extract_icon(path: str, index: int) -> None:
1919
if not path.endswith(".ico"):
2020
try:
2121
extractor = IconExtractor(path)
22-
extractor.export_icon(preferences.temp + "\\icon.ico", index)
22+
23+
if not index < 0: extractor.export_icon(preferences.temp + "\\icon.ico", num = index)
24+
else: extractor.export_icon(preferences.temp + "\\icon.ico", resource_id = index * -1)
2325
except:
2426
extractor = IconExtractor(path.lower().replace("system32", "systemresources") + ".mun")
25-
extractor.export_icon(preferences.temp + "\\icon.ico", index)
27+
28+
if not index < 0: extractor.export_icon(preferences.temp + "\\icon.ico", num = index)
29+
else: extractor.export_icon(preferences.temp + "\\icon.ico", resource_id = index * -1)
2630
else:
2731
shutil.copyfile(path, preferences.temp + "\\icon.ico")
2832

utils/shortcut.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ def create_folder_shortcut(folder_path: str, name: str, icon_path: str, icon_ind
7474

7575

7676
def delete_remnants():
77-
if not os.path.exists(preferences.working_folder + "\\shortcut"):
77+
if os.path.exists(preferences.working_folder + "\\shortcut"):
7878
shutil.rmtree(preferences.working_folder + "\\shortcut")
7979
os.mkdir(preferences.working_folder + "\\shortcut")
8080

0 commit comments

Comments
 (0)