#REFACTORING by cg
authorClaus Gittinger <cg@exept.de>
Fri, 14 Oct 2016 17:58:55 +0200
changeset 20663 0c2ac3c3937e
parent 20662 89b49379912a
child 20664 7d208f11cb95
#REFACTORING by cg class: Smalltalk added: #addIdeTopDirectoryToPackagePath changed: #addIDETopDirectoryToPackagePath #addWorkspaceDirectoryToPackagePath #initSystemPath path fixes
Smalltalk.st
--- a/Smalltalk.st	Fri Oct 14 17:54:48 2016 +0200
+++ b/Smalltalk.st	Fri Oct 14 17:58:55 2016 +0200
@@ -523,6 +523,7 @@
         PackagePath := OperatingSystem defaultPackagePath.
     ].
     self addWorkspaceDirectoryToPackagePath.
+    self addIdeTopDirectoryToPackagePath.
 
     "
      Smalltalk initSystemPath
@@ -6764,6 +6765,36 @@
 
 !Smalltalk class methodsFor:'system management-files'!
 
+addIdeTopDirectoryToPackagePath
+    "{ Pragma: +optSpace }"
+
+    |topDirectory|
+    
+    (topDirectory := OperatingSystem pathOfSTXExecutable) notNil ifTrue:[
+        topDirectory := topDirectory asFilename.
+        (topDirectory directory / 'stc') exists ifTrue:[
+            topDirectory := topDirectory directory.
+        ] ifFalse:[    
+            (topDirectory directory directory / 'stc') exists ifTrue:[
+                topDirectory := topDirectory directory directory.
+            ] ifFalse:[    
+                (topDirectory directory directory directory / 'stc') exists ifTrue:[
+                    topDirectory := topDirectory directory directory directory.
+                ] ifFalse:[
+                    topDirectory := nil
+                ].    
+            ].    
+        ].    
+        topDirectory notNil ifTrue:[
+            "/ one above "stx"
+            topDirectory := topDirectory directory pathName. 
+            (PackagePath includes:topDirectory) ifFalse:[
+                PackagePath add:topDirectory
+            ]    
+        ]    
+    ].
+!
+
 addWorkspaceDirectoryToPackagePath
     "{ Pragma: +optSpace }"
 
@@ -6771,7 +6802,10 @@
     
     (workspaceDirectory := UserPreferences current workspaceDirectory) notNil ifTrue:[
         (workspaceDirectory := workspaceDirectory asFilename) exists ifTrue:[
-            PackagePath addFirst:workspaceDirectory pathName
+            workspaceDirectory := workspaceDirectory pathName. 
+            (PackagePath includes:workspaceDirectory) ifFalse:[
+                PackagePath addFirst:workspaceDirectory
+            ]    
         ]    
     ].
 !