Skip to content

Commit 34ab825

Browse files
authored
Make plugin more packagable friendly
1 parent 46a671a commit 34ab825

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

plugindevtools/PluginDevTools/GetKritaAPI.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,12 @@ def updateData(self, kritaVersion, defaultTimeout = 5):
8383
data = source.read()
8484
with zipfile.ZipFile(io.BytesIO(data)) as myzip:
8585
if 'krita-'+tag+'-libs-libkis/libs/libkis/Window.h' in myzip.namelist():
86-
with open( os.path.dirname(os.path.realpath(__file__)) + '.KritaAPI.'+kritaVersion+'.zip', 'wb') as f:
86+
respath = Krita.instance().readSetting('','ResourceDirectory','')
87+
if respath == '':
88+
respath = os.path.dirname(os.path.realpath(__file__))
89+
else:
90+
respath+='/pykrita/PluginDevTools'
91+
with open( respath + '.KritaAPI.'+kritaVersion+'.zip', 'wb') as f:
8792
f.write(data)
8893
f.close()
8994
return { 'status': 1, 'data': { 'updated': date } }
@@ -100,8 +105,12 @@ def updateData(self, kritaVersion, defaultTimeout = 5):
100105

101106
def parseData(self, kritaVersion):
102107
mapDict = {}
103-
104-
with zipfile.ZipFile( os.path.dirname(os.path.realpath(__file__)) + '.KritaAPI.'+kritaVersion+'.zip' ) as myzip:
108+
respath = Krita.instance().readSetting('','ResourceDirectory','')
109+
if respath == '':
110+
respath = os.path.dirname(os.path.realpath(__file__))
111+
else:
112+
respath+='/pykrita/PluginDevTools'
113+
with zipfile.ZipFile( respath + '.KritaAPI.'+kritaVersion+'.zip' ) as myzip:
105114
for fn in myzip.namelist():
106115
if fn.endswith('.h') and '/Test/' not in fn:
107116
content = str(myzip.read(fn),'utf-8')

0 commit comments

Comments
 (0)