]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Two related fixes:
authorJack Jansen <jack.jansen@cwi.nl>
Sat, 1 Nov 2003 22:28:19 +0000 (22:28 +0000)
committerJack Jansen <jack.jansen@cwi.nl>
Sat, 1 Nov 2003 22:28:19 +0000 (22:28 +0000)
- The code for setting the working directory to $HOME was both incorrect
and in the wrong place, fixed.
- On OSX the default location for IDE scripts is now
$HOME/Library/Python/IDE-Scripts.

Together, these solve the problem that some people had (but, curiously
enough, only some) that the IDE crashed at startup because it couldn't
create "/Scripts".

Mac/Tools/IDE/PythonIDEMain.py

index 5987c10d79a5779f5e03a0581a5cee283c533a3c..6641fcdfe4e9ce82c78967f23ab19ef5e88665cc 100644 (file)
@@ -32,6 +32,12 @@ def getmodtime(file):
 class PythonIDE(Wapplication.Application):
        
        def __init__(self):
+               if sys.platform == "darwin":
+                       if len(sys.argv) > 1 and sys.argv[1].startswith("-psn"):
+                               home = os.getenv("HOME")
+                               if home:
+                                       os.chdir(home)
+               print "We are in", os.getcwd()
                self.preffilepath = os.path.join("Python", "PythonIDE preferences")
                Wapplication.Application.__init__(self, 'Pide')
                from Carbon import AE
@@ -49,11 +55,6 @@ class PythonIDE(Wapplication.Application):
                                self.quitevent)
                import PyConsole, PyEdit
                Splash.wait()
-               if sys.platform == "darwin":
-                       if sys.argv and sys.argv[0].startswith("-psn"):
-                               home = os.getenv("HOME")
-                               if home:
-                                       os.chdir(home)
                # With -D option (OSX command line only) keep stderr, for debugging the IDE
                # itself.
                debug_stderr = None
@@ -140,9 +141,12 @@ class PythonIDE(Wapplication.Application):
                except:
                        path = os.path.join(os.getcwd(), "Mac", "IDE scripts")
                        if not os.path.exists(path):
-                               path = os.path.join(os.getcwd(), "Scripts")
+                               if sys.platform == "darwin":
+                                       path = os.path.join(os.getenv("HOME"), "Library", "Python", "IDE-Scripts")
+                               else:
+                                       path = os.path.join(os.getcwd(), "Scripts")
                                if not os.path.exists(path):
-                                       os.mkdir(path)
+                                       os.makedirs(path)
                                        f = open(os.path.join(path, "Place your scripts here"+ELIPSES), "w")
                                        f.close()
                        fsr = File.FSRef(path)