Smalltalk.st
branchjv
changeset 17841 7abcc4aef871
parent 17834 04ff72c5039a
child 17844 29a1536dffe4
--- a/Smalltalk.st	Fri Jun 03 18:15:16 2011 +0100
+++ b/Smalltalk.st	Wed Jun 08 22:53:07 2011 +0100
@@ -24,7 +24,8 @@
 		BitmapDirName PackageDirName FileInDirName ChangeFileName
 		ImageStartTime ImageRestartTime DemoMode SaveEmergencyImage
 		SpecialObjectArray CallbackSignal KnownPackages
-		ClassesFailedToInitialize HasNoConsole IgnoreHalt'
+		ClassesFailedToInitialize HasNoConsole IgnoreHalt
+		PackageToPathMapping'
 	poolDictionaries:''
 	category:'System-Support'
 !
@@ -1039,6 +1040,7 @@
     "Created: 20.6.1997 / 16:58:28 / cg"
 ! !
 
+
 !Smalltalk class methodsFor:'browsing'!
 
 browseAllCallsOn:aSelectorSymbol
@@ -2388,10 +2390,10 @@
     |p t new|
 
     (self fileIn:aFilename) ifFalse:[
-        (self fileInClassLibrary: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.
@@ -5890,14 +5892,9 @@
     "same as fileIn:, but do not output 'compiled...'-messages on Transcript.
      Main use is during startup."
 
-    |wasSilent|
-
-    wasSilent := self silentLoading:true.
-    [
+    self silentlyLoadingDo:[
 	self fileIn:aFilename
-    ] ensure:[
-	self silentLoading:wasSilent
-    ]
+    ].
 ! !
 
 !Smalltalk class methodsFor:'system management-files'!
@@ -6090,6 +6087,22 @@
     "
 !
 
+findPackageDirectoryForPackage:aPackage
+    "find a packages directory along a number of standard places"
+
+    |relDir|
+
+    relDir := Smalltalk relativePackagePathForPackage:aPackage.
+    relDir asFilename isAbsolute ifTrue:[^ relDir].
+
+    ^ Smalltalk getPackageFileName:relDir.
+
+    "
+     Smalltalk findPackageDirectoryForPackage:'stx:libview/resources'
+     Smalltalk findPackageDirectoryForPackage:'stx:libview'
+    "
+!
+
 flushPathCaches
     "{ Pragma: +optSpace }"
 
@@ -6797,6 +6810,25 @@
     ].
 !
 
+relativePackagePathForPackage:aPackage
+    |path|
+
+    PackageToPathMapping notNil ifTrue:[
+	path := PackageToPathMapping at:aPackage ifAbsent:nil.
+	PackageToPathMapping notNil ifTrue:[^ path].
+    ].
+    ^ aPackage copyReplaceAll:$: with:$/.
+
+    "
+     PackageToPathMapping := Dictionary new.
+     PackageToPathMapping at:'expeccoNET:server' put:'expeccoNET_oldVersion/server'.
+     PackageToPathMapping at:'expeccoNET:server/ui' put:'expeccoNET_oldVersion/server/ui'.
+
+     Smalltalk relativePackagePathForPackage:'stx:libview/resources'
+     Smalltalk relativePackagePathForPackage:'stx:libview'
+    "
+!
+
 resourceDirectoryForPackage:aPackage
     "given a packageID, return the path to its resource directory;
      nil if not found."
@@ -7564,14 +7596,15 @@
 !Smalltalk class methodsFor:'documentation'!
 
 version
-    ^ '$Id: Smalltalk.st 10632 2011-04-09 17:19:04Z vranyj1 $'
+    ^ '$Id: Smalltalk.st 10643 2011-06-08 21:53:07Z vranyj1 $'
 !
 
 version_CVS
-    ^ 'Header: /var/local/cvs/stx/libbasic/Smalltalk.st,v 1.949 2011-03-23 16:26:18 stefan Exp '
+    ^ 'Header: /cvs/stx/stx/libbasic/Smalltalk.st,v 1.952 2011/05/14 08:10:16 cg Exp '
 !
 
 version_SVN
-    ^ '$Id: Smalltalk.st 10632 2011-04-09 17:19:04Z vranyj1 $'
+    ^ '$Id: Smalltalk.st 10643 2011-06-08 21:53:07Z vranyj1 $'
 ! !
 
+