chiark / gitweb /
Implement a fallback if the Foundation import fails. Stupid MacOS.
authorDaid <Daid303@gmail.com>
Thu, 27 Jun 2013 09:36:46 +0000 (11:36 +0200)
committerDaid <Daid303@gmail.com>
Thu, 27 Jun 2013 09:36:46 +0000 (11:36 +0200)
Cura/util/resources.py

index 1dad2ade297f76202aac9b6e5da5da873b2fdee9..ad1e5ebc2364ee1719e5dc79a9ea45f0a853e694 100644 (file)
@@ -9,8 +9,12 @@ __all__ = ['getPathForResource', 'getPathForImage', 'getPathForMesh']
 
 if sys.platform.startswith('darwin'):
        if hasattr(sys, 'frozen'):
-               from Foundation import *
-               resourceBasePath = NSBundle.mainBundle().resourcePath()
+               try:
+                       #Foundation import can crash on some MacOS installs
+                       from Foundation import *
+                       resourceBasePath = NSBundle.mainBundle().resourcePath()
+               except:
+                       resourceBasePath = os.path.join(os.path.dirname(__file__), "../../../../../")
        else:
                resourceBasePath = os.path.join(os.path.dirname(__file__), "../resources")
 else: