Skip to content

Commit dca2f83

Browse files
committed
Refine cross protection code
1 parent ee09be3 commit dca2f83

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/protect_code.pt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,14 @@ def protect_pytransform():
4242
raise RuntimeError('unexpected pytransform.py')
4343

4444
def check_lib_pytransform():
45+
platname = pytransform.sys.platform
46+
libname = '_pytransform.dylib' if platname.startswith('darwin') else \
47+
'_pytransform.dll' if platname.startswith('win') else \
48+
'_pytransform.so'
4549
if getattr(pytransform.sys, 'frozen', False):
46-
filename = pytransform.os.path.join(pytransform.sys._MEIPASS, {filename})
50+
filename = pytransform.os.path.join(pytransform.sys._MEIPASS, libname)
4751
else:
48-
filename = pytransform.os.path.join({rpath}, {filename})
52+
filename = pytransform.os.path.join({rpath}, libname)
4953
size = {size}
5054
n = size >> 2
5155
with open(filename, 'rb') as f:

0 commit comments

Comments
 (0)