SteamAutoCracker icon indicating copy to clipboard operation
SteamAutoCracker copied to clipboard

pefile replacement

Open axet opened this issue 1 year ago • 1 comments

Allow to work on linux (get rid of win32api)

diff --git a/sac_lib/get_file_version.py b/sac_lib/get_file_version.py
index da53c0b..cacc012 100644
--- a/sac_lib/get_file_version.py
+++ b/sac_lib/get_file_version.py
@@ -1,5 +1,5 @@
-import win32api
+import pefile
 
 def GetFileVersion(filename: str) -> str:
-    fileInfos = win32api.GetFileVersionInfo(filename, "\\")
-    return "%d.%d.%d.%d" % (fileInfos['FileVersionMS'] / 65536, fileInfos['FileVersionMS'] % 65536, fileInfos['FileVersionLS'] / 65536, fileInfos['FileVersionLS'] % 65536)
\ No newline at end of file
+    fileInfos = pefile.PE(filename).VS_FIXEDFILEINFO
+    return "%d.%d.%d.%d" % (fileInfos.FileVersionMS >> 16, fileInfos.FileVersionMS & 0xFFFF, fileInfos.FileVersionLS >> 16, fileInfos.FileVersionLS & 0xFFFF)

axet avatar Sep 14 '24 07:09 axet

Thanks! I'll test it and update if it works :)

How did you get all these colors? That's nice, didn't know that was possible to be shown in a github issue message

(and again for the really late response)

BigBoiCJ avatar Oct 19 '24 10:10 BigBoiCJ