changed: #readFromFile:directory:
authorClaus Gittinger <cg@exept.de>
Sat, 20 Aug 2011 17:13:07 +0200
changeset 5781 fc35ed4fd223
parent 5780 7acd722f9cf9
child 5782 59f177baaa8c
changed: #readFromFile:directory:
ResourcePack.st
--- a/ResourcePack.st	Sun Jul 24 21:40:42 2011 +0200
+++ b/ResourcePack.st	Sat Aug 20 17:13:07 2011 +0200
@@ -1176,14 +1176,22 @@
     |inStream ok|
 
     fileReadFailed := false.
-    dirName = 'resources' ifTrue:[
-        inStream := Smalltalk resourceFileStreamFor:fileName
-    ] ifFalse:[
-        inStream := Smalltalk 
-                        systemFileStreamFor:(dirName 
-                                                isNil ifTrue:[fileName]
-                                                ifFalse:[dirName asFilename construct:fileName]).
+    "/ need to catch errors here, as the handler might itself need resources.
+    "/ (happens when da.rs is not present in libbasic/resources.rs)
+    ExternalStream openErrorSignal handle:[:ex |
+        Transcript showCR:'ResourcePack: failed to open file: ',fileName asString,' in ',dirName asString.
+        inStream := nil.
+    ] do:[
+        dirName = 'resources' ifTrue:[
+            inStream := Smalltalk resourceFileStreamFor:fileName
+        ] ifFalse:[
+            inStream := Smalltalk systemFileStreamFor:
+                            (dirName isNil 
+                                ifTrue:[fileName]
+                                ifFalse:[dirName asFilename construct:fileName]).
+        ].
     ].
+
     inStream isNil ifTrue:[
         "
          an empty pack
@@ -1200,7 +1208,7 @@
         ('ResourcePack [warning]: ''' , inStream pathName , ''' contains error(s) - data may be incomplete.') errorPrintCR.
     ].
 
-    "Modified: / 19-10-2006 / 22:46:48 / cg"
+    "Modified: / 20-08-2011 / 17:10:02 / cg"
 !
 
 readFromResourceStream:inStream in:dirName
@@ -1390,11 +1398,11 @@
 !ResourcePack class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.148 2010-11-13 10:42:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.149 2011-08-20 15:13:07 cg Exp $'
 !
 
 version_CVS
-    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.148 2010-11-13 10:42:05 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libview/ResourcePack.st,v 1.149 2011-08-20 15:13:07 cg Exp $'
 ! !
 
 ResourcePack initialize!