diff --git a/src/Mod/OpenSCAD/OpenSCADUtils.py b/src/Mod/OpenSCAD/OpenSCADUtils.py index 6328b93ff..de0150892 100644 --- a/src/Mod/OpenSCAD/OpenSCADUtils.py +++ b/src/Mod/OpenSCAD/OpenSCADUtils.py @@ -55,6 +55,17 @@ def searchforopenscadexe(): if os.path.isfile(testpath): return testpath elif sys.platform == 'darwin': + ascript = ('tell application "Finder"\n' + 'POSIX path of (application file id "org.openscad.OpenSCAD"' + 'as alias)\n' + 'end tell') + p1=subprocess.Popen(['osascript','-'],stdin=subprocess.PIPE,\ + stdout=subprocess.PIPE,stderr=subprocess.PIPE) + stdout,stderr = p1.communicate(ascript) + if p1.returncode == 0: + opathl=stdout.split('\n') + if len(opathl) >=1: + return opathl[0]+'Contents/MacOS/OpenSCAD' #test the default path testpath="/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD" if os.path.isfile(testpath):