report erro, when asking NoProject for directory/module
authorClaus Gittinger <cg@exept.de>
Tue, 28 Nov 2006 15:46:37 +0100
changeset 10208 8248266e5c0d
parent 10207 b5ca553d15ad
child 10209 c0c971f94c61
report erro, when asking NoProject for directory/module
PackageId.st
--- a/PackageId.st	Tue Nov 28 12:23:31 2006 +0100
+++ b/PackageId.st	Tue Nov 28 15:46:37 2006 +0100
@@ -147,7 +147,14 @@
      The module is typically used to define the project-path or project-id within its
      sourcecode repository (which is selected via the module)."
 
-    ^ packageIdString copyFrom:(packageIdString indexOf:$:)+1
+    |idx|
+
+    idx := packageIdString indexOf:$:.
+    idx == 0 ifTrue:[
+        self error:'NoProject asked for its directory' mayProceed:true.
+        ^ nil.
+    ].
+    ^ packageIdString copyFrom:idx+1
 
     "
      (PackageId from:'stx:libbasic') module  
@@ -157,6 +164,7 @@
     "
 
     "Created: / 18-08-2006 / 12:15:33 / cg"
+    "Modified: / 28-11-2006 / 11:39:14 / cg"
 !
 
 libraryName
@@ -182,7 +190,14 @@
     "return the module component. Thats the first component up to the colon.
      The module is typically used to select a corresponding sourcecode repository."
 
-    ^ packageIdString upTo:$:
+    |idx|
+
+    idx := packageIdString indexOf:$:.
+    idx == 0 ifTrue:[
+        self error:'NoProject asked for its module' mayProceed:true.
+        ^ nil.
+    ].
+    ^ packageIdString copyTo:idx-1
 
     "
      (PackageId from:'stx:libbasic') module  
@@ -190,6 +205,7 @@
     "
 
     "Created: / 18-08-2006 / 12:13:53 / cg"
+    "Modified: / 28-11-2006 / 11:38:53 / cg"
 !
 
 parentPackage
@@ -214,5 +230,5 @@
 !PackageId class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/PackageId.st,v 1.7 2006-11-22 11:17:11 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/PackageId.st,v 1.8 2006-11-28 14:46:37 cg Exp $'
 ! !