handle degenerated package string from other modules,
authorClaus Gittinger <cg@exept.de>
Mon, 17 Mar 1997 15:18:07 +0100
changeset 2453 603af5a4e0fc
parent 2452 7262e3b2c20a
child 2454 479b4c4bb05e
handle degenerated package string from other modules, without color-separated module-name.
Class.st
--- a/Class.st	Mon Mar 17 12:30:21 1997 +0100
+++ b/Class.st	Mon Mar 17 15:18:07 1997 +0100
@@ -4344,7 +4344,7 @@
     "
 
     |owner sourceInfo packageString idx1 idx2 
-     moduleString directoryString libraryString components|
+     moduleString directoryString libraryString components dirComponents mgr|
 
     (owner := self owningClass) notNil ifTrue:[^ owner packageSourceCodeInfo].
 
@@ -4357,7 +4357,10 @@
         idx2 ~~ 0 ifTrue:[
             sourceInfo := packageString copyFrom:idx1 + 1 to:idx2 - 1
         ]
+    ] ifFalse:[
+        sourceInfo := packageString
     ].
+
     sourceInfo isNil ifTrue:[^ nil].
     components := sourceInfo asCollectionOfSubstringsSeparatedBy:$:.
     components size == 0 ifTrue:[
@@ -4366,12 +4369,22 @@
         ^ nil
     ] ifFalse:[
         components size == 1 ifTrue:[
-            "/ a single name given - the module becomes 'stx',
-            "/ if the component includes slashes, its the directory
+            "/ a single name given - the module becomes 'stx' or
+            "/ the very first directory component (if such a module exists).
+            "/ If the component includes slashes, its the directory
             "/ otherwise the library
             "/ 
-            moduleString := 'stx'.
-            directoryString := libraryString := components at:1.
+            dirComponents := Filename components:(components at:1).     
+            (dirComponents size > 1
+            and:[(mgr := self sourceCodeManager) notNil
+            and:[mgr checkForExistingModule:dirComponents first]]) ifTrue:[
+                moduleString := dirComponents first.
+                directoryString := libraryString := (Filename fromComponents:(dirComponents copyFrom:2)) asString.
+            ] ifFalse:[
+                moduleString := 'stx'.
+                directoryString := libraryString := components at:1.
+            ].
+
             (libraryString includes:$/) ifTrue:[
                 libraryString := libraryString asFilename baseName
             ]
@@ -4428,7 +4441,7 @@
     "
 
     "Created: 4.11.1995 / 20:36:53 / cg"
-    "Modified: 15.10.1996 / 18:56:03 / cg"
+    "Modified: 17.3.1997 / 15:12:32 / cg"
 !
 
 revision
@@ -4894,6 +4907,6 @@
 !Class class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.258 1997-03-05 16:07:22 ca Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.259 1997-03-17 14:18:07 cg Exp $'
 ! !
 Class initialize!