Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add support for macOS #12

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Try to find imobiledevice dylib
  • Loading branch information
CyrilSLi committed Mar 26, 2024
commit da14d063bc9db804c6ec073156da763eba4a5818
20 changes: 14 additions & 6 deletions rvi_capture.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import sys
import time
import shutil
import os


def load_cdll():
Expand All @@ -21,15 +22,22 @@ def load_cdll():
pass
raise OSError('libimobiledevice not found!')
elif sys.platform == 'darwin':
try:
return ctypes.CDLL(shutil.which('ideviceinfo'))
except OSError:
pass
raise OSError('libimobiledevice not found!')
if shutil.which ('ideviceinfo'):
lib_path = os.path.join(os.path.dirname(os.path.dirname((os.path.realpath(shutil.which('ideviceinfo'))))), 'lib')
for i in os.listdir(lib_path):
if i.startswith('libimobiledevice') and os.path.splitext(i)[1] == '.dylib' and not os.path.islink(i):
try:
return ctypes.CDLL(os.path.join(lib_path, i))
except OSError:
pass
try:
return ctypes.CDLL(shutil.which ('ideviceinfo'))
except OSError:
pass
raise OSError('libimobiledevice not found!')
elif sys.platform == 'win32':
import hashlib
import tempfile
import os
from zipfile import ZipFile
from urllib.request import urlopen
if sys.maxsize >> 32:
Expand Down