Skip to content

Commit bdab7ce

Browse files
committed
update
1 parent 44ab605 commit bdab7ce

1 file changed

Lines changed: 16 additions & 10 deletions

File tree

src/model/ZipUtil.py

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,23 +4,29 @@
44
ZIP_PASS=DEF.ZIP_PASS
55

66
import os
7+
import zipfile
78
class Ziputil():
89
def __init__(self, ziptoolpath:str, zipfilepath:str):
910
self.ziptoolpath=ziptoolpath
1011
self.zipfilepath=zipfilepath
1112
self.password=ZIP_PASS
13+
self.using7z=True
14+
if len(self.ziptoolpath)==0:
15+
self.using7z=False
1216
def getzipfile(self):
13-
with open('blankfile','w') as f:
14-
f.write('\n')
15-
command=' a '+self.zipfilepath+' '+os.getcwd()+'\\blankfile -p'+ZIP_PASS
16-
print(self.ziptoolpath+command)
17-
code=os.system(self.ziptoolpath+command)
18-
return code
17+
if self.using7z:
18+
with open('blankfile','w') as f:
19+
f.write('\n')
20+
command=' a '+self.zipfilepath+' '+os.getcwd()+'\\blankfile -p'+ZIP_PASS
21+
print(self.ziptoolpath+command)
22+
code=os.system(self.ziptoolpath+command)
23+
return code
1924
def genzipfile(self,folder_path:str):
20-
command=" a -t7z -scsUTF-8 "+self.zipfilepath+" "+folder_path+"\\* -p"+ZIP_PASS
21-
print(self.ziptoolpath+command)
22-
code = os.system(self.ziptoolpath + command)
23-
return code
25+
if self.using7z:
26+
command=" a -t7z -scsUTF-8 "+self.zipfilepath+" "+folder_path+"\\* -p"+ZIP_PASS
27+
print(self.ziptoolpath+command)
28+
code = os.system(self.ziptoolpath + command)
29+
return code
2430

2531

2632
def load_serval(str_serval:str): #load a serval file

0 commit comments

Comments
 (0)