From 58746b11a29fa7cf377ea9e28601c4b8b1b1159a Mon Sep 17 00:00:00 2001 From: daid303 Date: Mon, 24 Dec 2012 11:55:00 +0100 Subject: [PATCH] Fix the default example path, and add support for version file in frozen build. --- Cura/util/profile.py | 2 +- Cura/util/version.py | 7 ++++++- package.sh | 3 +++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Cura/util/profile.py b/Cura/util/profile.py index c15de19a..f27227a6 100644 --- a/Cura/util/profile.py +++ b/Cura/util/profile.py @@ -150,7 +150,7 @@ G92 E0 } preferencesDefaultSettings = { 'startMode': 'Simple', - 'lastFile': os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'example', 'UltimakerRobot_support.stl')), + 'lastFile': os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)), '..', 'resources', 'example', 'UltimakerRobot_support.stl')), 'machine_width': '205', 'machine_depth': '205', 'machine_height': '200', diff --git a/Cura/util/version.py b/Cura/util/version.py index ce3c934c..93117f7c 100644 --- a/Cura/util/version.py +++ b/Cura/util/version.py @@ -1,10 +1,15 @@ from __future__ import absolute_import import os +import sys +from Cura.util import resources def getVersion(getGitVersion = True): gitPath = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../../.git")) - versionFile = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../version")) + if hasattr(sys, 'frozen'): + versionFile = os.path.normpath(os.path.join(resources.resourceBasePath, "version")) + else: + versionFile = os.path.abspath(os.path.join(os.path.split(os.path.abspath(__file__))[0], "../version")) if os.path.exists(gitPath): if not getGitVersion: return "dev" diff --git a/package.sh b/package.sh index 748829e3..12693f17 100755 --- a/package.sh +++ b/package.sh @@ -106,6 +106,9 @@ if [ "$BUILD_TARGET" = "darwin" ]; then #For now, just copy all of Cura so pypy can find it cp -a Cura scripts/darwin/dist/Cura.app/Contents/Resources/ + #Add cura version file (should read the version from the bundle with pyobjc, but will figure that out later) + echo $BUILD_NAME > scripts/darwin/dist/Cura.app/Contents/Resources/version + cd scripts/darwin # Install QuickLook plugin -- 2.30.2