-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIconExtractor.py
36 lines (29 loc) · 1.02 KB
/
IconExtractor.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
from zipfile import ZipFile
import os
import shutil
def GetmodIcons(modfp):
micons = {}
for root, dirs, files in os.walk(modfp, topdown=False):
for name in files:
path = os.path.join(root, name)
key = path
if name.endswith('.zip'):
with ZipFile(path) as myzip:
infolist = myzip.infolist()
micons[key] = infolist
return micons
def GetBaseIcons(basefp):
bicons = {}
for root, dirs, files in os.walk(basefp, topdown=False):
for name in files:
path = os.path.join(root, name)
key = name
bicons[key] = path
return bicons
if __name__ == "__main__":
target = "/lifesupport-canister.png"
modfp= r"C:\Users\rudyb\AppData\Roaming\Factorio\mods"
basefp = r"C:\Program Files (x86)\Steam\steamapps\common\Factorio\data\base\graphics\icons"
bicons =GetBaseIcons(basefp)
for item in bicons:
print (bicons[item])