search in package directory
authorClaus Gittinger <cg@exept.de>
Wed, 01 Dec 1999 19:00:14 +0100
changeset 3046 a8ba36b04c26
parent 3045 a4d9f898c3fb
child 3047 021c2b15c27f
search in package directory
ResourcePack.st
--- a/ResourcePack.st	Wed Dec 01 18:47:20 1999 +0100
+++ b/ResourcePack.st	Wed Dec 01 19:00:14 1999 +0100
@@ -195,18 +195,26 @@
     "get the full resource definitions for aClass (i.e. with super packs).
      Also leave the resulting pack in the cache for faster access next time."
 
-    |nm pack superPack pkg prj prjDir baseName|
+    |nm pack superPack pkg prj prjDir baseName pathes|
 
     nm := aClass resourcePackName.
     pack := self searchCacheFor:nm.
     pack notNil ifTrue:[^ pack].
 
-    ((pkg := aClass package) startsWith:'stx:') ifFalse:[
-        "/ there might be a package specific resource directory ...
-        prj := Project projectWithId:pkg.
-        prj notNil ifTrue:[
-            prjDir := prj directory.
-        ].
+    pkg := aClass package.
+    "/ search in the classes package directory first ...
+
+    "/ there might be a package specific resource directory ...
+    "/ in the directory, from which the project was loaded
+    prj := Project projectWithId:pkg.
+    prj notNil ifTrue:[
+        prjDir := prj directory.
+    ] ifFalse:[
+        prjDir := 'packages/' , (pkg copyReplaceAll:$: with:$/) , '/resources'.
+        pathes := Smalltalk constructPathFor:prjDir.
+        pathes size > 0 ifTrue:[
+            prjDir := pathes first , prjDir
+        ]
     ].
 
     baseName := (Smalltalk fileNameForClass:nm) , '.rs'.
@@ -227,9 +235,10 @@
     ^ pack
 
     "
-     ResourcePack for:TextView
+     ResourcePack for:TextView     
      ResourcePack for:CodeView
-     ResourcePack for:Workspace 
+     ResourcePack for:Workspace  
+     ResourcePack for:View  
      ResourcePack for:ErrorLogger 
      Workspace classResources
     "
@@ -742,6 +751,6 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.55 1999-10-27 23:00:08 stefan Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.56 1999-12-01 18:00:14 cg Exp $'
 ! !
 ResourcePack initialize!