mirror of
https://github.com/lcdr/utils.git
synced 2024-08-30 17:32:16 +00:00
Fixed pkviewer not working on all OSes.
This commit is contained in:
parent
d3172da5ef
commit
a99be7f585
@ -1,5 +1,7 @@
|
|||||||
import hashlib
|
import hashlib
|
||||||
import os
|
import os
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
import tempfile
|
import tempfile
|
||||||
|
|
||||||
import tkinter.filedialog as filedialog
|
import tkinter.filedialog as filedialog
|
||||||
@ -144,7 +146,12 @@ class PKViewer(viewer.Viewer):
|
|||||||
tempfile_path = os.path.join(tempfile.gettempdir(), os.path.basename(path))
|
tempfile_path = os.path.join(tempfile.gettempdir(), os.path.basename(path))
|
||||||
with open(tempfile_path, "wb") as file:
|
with open(tempfile_path, "wb") as file:
|
||||||
file.write(data)
|
file.write(data)
|
||||||
os.startfile(tempfile_path)
|
|
||||||
|
if sys.platform == "win32":
|
||||||
|
os.startfile(tempfile_path)
|
||||||
|
else:
|
||||||
|
opener = "open" if sys.platform == "darwin" else "xdg-open"
|
||||||
|
subprocess.call([opener, tempfile_path])
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
app = PKViewer()
|
app = PKViewer()
|
||||||
|
Loading…
Reference in New Issue
Block a user