Smalltalk.st
changeset 6025 b5822854231c
parent 6020 555c690e6616
child 6031 b52a3bb1c9ff
--- a/Smalltalk.st	Mon Sep 10 16:18:50 2001 +0200
+++ b/Smalltalk.st	Mon Sep 10 16:49:21 2001 +0200
@@ -4108,6 +4108,36 @@
     "Modified: 8.1.1997 / 17:58:56 / cg"
 !
 
+fileInClassLibrary:aClassLibraryName inPackage:packageID
+    "find an object file containing a binary class library in some standard places
+     and load it. This install all of its contained classes.
+     Return true if ok, false if not.
+     Notice: the argument may not have an extension (by purpose);
+             the sharedLib extension (.dll / .so / .sl) is added here, to
+             make the caller independent of the underlying operatingSystem."
+
+    |path fn|
+
+    ObjectFileLoader isNil ifTrue:[^ false].
+
+    fn := aClassLibraryName , (ObjectFileLoader sharedLibraryExtension).
+
+    path := self getPackageDirectoryForPackage:packageID.
+    path isNil ifTrue:[^ false].
+    path := path asFilename construct:fn.
+    path exists ifFalse:[^ false].
+
+    ^ (ObjectFileLoader loadObjectFile:path pathName) notNil
+
+    "
+     Smalltalk fileInClassLibrary:'libtable'
+     Smalltalk fileInClassLibrary:'binary/libwidg3'
+     Smalltalk fileInClassLibrary:'refactoryBrowser' inPackage:'stx:goodies/refactoryBrowser'
+    "
+
+    "Modified: 8.1.1997 / 17:58:56 / cg"
+!
+
 fileInStream:aStream lazy:lazy silent:silent logged:logged addPath:morePath
     "read sourceCode from aStream;
      return true if ok, false if failed.
@@ -5360,8 +5390,10 @@
     |p t new|
 
     (self fileIn:aFilename) ifFalse:[
-	self warn:'Failed to load the package ', packageId printString.
-	^ false.
+        (self fileInClassLibrary:aFilename) ifFalse:[
+            self warn:'Failed to load the package ', packageId printString.
+            ^ false.
+        ]
     ].
 
     new := (p := Project projectWithId:packageId) isNil.
@@ -6007,5 +6039,5 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.500 2001-09-10 14:14:14 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.501 2001-09-10 14:49:21 cg Exp $'
 ! !