From 35eeb729b54f1ae92b350b79f0334be0707519da Mon Sep 17 00:00:00 2001 From: Tat-Chee Wan (USM Signature) Date: Fri, 15 Nov 2013 15:42:32 +0800 Subject: improved error handling and reporting for bluetooth compat hack --- pyfantom.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/pyfantom.py b/pyfantom.py index daf9b17..c65c275 100644 --- a/pyfantom.py +++ b/pyfantom.py @@ -62,8 +62,14 @@ if platform_type == 'Darwin': if platform_rel >= MACOSX_BTMODVER: print " Bluetooth Stack not supported (Rel >= %s)" % MACOSX_BTMODVER MACOSX_BTENABLE = False + if os.getenv("DYLD_FORCE_FLAT_NAMESPACE") is None: + raise RuntimeError("Bluetooth Compat Framework needed.\n" + "Enable IOBluetooth-Compat Framework using:\n" + "$ export DYLD_FORCE_FLAT_NAMESPACE=1\n") + #compatlibpath = ctypes.util.find_library('IOBluetooth-Compat.dylib') compatlibpath = '%s/Library/IOBluetooth-Compat.dylib' % os.getenv("HOME") - + if compatlibpath is None or not os.path.exists(compatlibpath): + raise RuntimeError("IOBluetooth-Compat Framework not found") from AppKit import NSAutoreleasePool, NSApplication elif platform_type == 'Linux': @@ -73,6 +79,7 @@ elif platform_type == 'Windows': else: raise RuntimeError('Unsupported platform') + if libpath is not None: if DEBUG: print "Found Fantom Library (", libpath, ")" -- cgit v1.2.3