From c27eefea32788673e00d630c06da64a2dcc7d552 Mon Sep 17 00:00:00 2001 From: Walter Bender Date: Wed, 23 Feb 2011 20:30:46 +0000 Subject: setting chdir defaults --- (limited to 'turtleart.py') diff --git a/turtleart.py b/turtleart.py index 8fdfa9a..a03464b 100755 --- a/turtleart.py +++ b/turtleart.py @@ -197,12 +197,18 @@ class TurtleMain(): sure our current directory is TA's source dir. """ dirname = os.path.dirname(__file__) if dirname == '': - dirname = '.' - try: + if os.path.exists(os.path.join('~', 'Activities', + 'TurtleArt.activity')): + os.chdir(os.path.join('~', 'Activities', + 'TurtleArt.activity')) + elif os.path.exists(self._INSTALL_PATH): + os.chdir(self._INSTALL_PATH) + elif os.path.exists(self._ALTERNATIVE_INSTALL_PATH): + os.chdir(self._ALTERNATIVE_INSTALL_PATH) + else: + os.chdir(os.path.abspath('.')) + else: os.chdir(dirname) - except OSError: - print ("Couldn't chdir to %s" % (dirname)) - self.ta_file = None self.output_png = False self.i = 0 # FIXME: use a better name for this variable -- cgit v0.9.1