if a SourceCodeManager is available, ask that one FIRST for the source,
THEN look in standard places. This avoids trouble, if some (obsolete)
sourcefile exists (for example, due to a fileOut)
--- a/Class.st Thu Nov 23 15:23:19 1995 +0100
+++ b/Class.st Thu Nov 23 15:28:24 1995 +0100
@@ -12,10 +12,10 @@
ClassDescription subclass:#Class
instanceVariableNames:'classvars comment subclasses classFilename package revision
- history'
+ history'
classVariableNames:'UpdatingChanges LockChangesFile FileOutErrorSignal
- CatchMethodRedefinitions MethodRedefinitionSignal
- UpdateChangeFileQuerySignal'
+ CatchMethodRedefinitions MethodRedefinitionSignal
+ UpdateChangeFileQuerySignal'
poolDictionaries:''
category:'Kernel-Classes'
!
@@ -106,7 +106,7 @@
!
version
-^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.81 1995-11-23 10:45:55 cg Exp $'! !
+^ '$Header: /cvs/stx/stx/libbasic/Class.st,v 1.82 1995-11-23 14:27:53 cg Exp $'! !
!Class class methodsFor:'initialization'!
@@ -933,13 +933,17 @@
source := (Smalltalk fileNameForClass:cls) , '.st'
].
- fileName := Smalltalk getSourceFileName:source.
-"/ fileName isNil ifTrue:[
-"/ fileName := source
-"/ ].
- fileName notNil ifTrue:[
- aStream := fileName asFilename readStream.
+ "/
+ "/ if there is no SourceCodeManager, look in
+ "/ standard places first
+ "/
+ SourceCodeManager isNil ifTrue:[
+ fileName := Smalltalk getSourceFileName:source.
+ fileName notNil ifTrue:[
+ aStream := fileName asFilename readStream.
+ ]
].
+
aStream isNil ifTrue:[
"/
"/ hard case - there is no source file for this class
@@ -976,9 +980,17 @@
"/ mhmh - still no source file.
"/ If there is a SourceCodeManager, ask it to aquire the
"/ the source for my class, and return an open stream on it.
+ "/ if that one does not know about the source, look in
+ "/ standard places
SourceCodeManager notNil ifTrue:[
aStream := SourceCodeManager sourceStreamFor:self.
+ aStream isNil ifTrue:[
+ fileName := Smalltalk getSourceFileName:source.
+ fileName notNil ifTrue:[
+ aStream := fileName asFilename readStream.
+ ]
+ ].
].
"/
@@ -994,10 +1006,11 @@
"
Object sourceStream
Clock sourceStream
+ Autoload sourceStream
"
"Created: 10.11.1995 / 21:05:13 / cg"
- "Modified: 23.11.1995 / 01:22:57 / cg"
+ "Modified: 23.11.1995 / 15:07:34 / cg"
! !
!Class methodsFor:'adding/removing'!
--- a/Method.st Thu Nov 23 15:23:19 1995 +0100
+++ b/Method.st Thu Nov 23 15:28:24 1995 +0100
@@ -36,7 +36,7 @@
!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.59 1995-11-23 00:27:24 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Method.st,v 1.60 1995-11-23 14:28:24 cg Exp $'
!
documentation
@@ -232,7 +232,7 @@
"
sourcePosition isNil ifTrue:[^ source].
"/
-"/ original code:
+"/ original (old) code:
"/
"/ aStream := Smalltalk systemFileStreamFor:('source/' , source).
"/ aStream notNil ifTrue:[
@@ -241,35 +241,52 @@
"/ aStream close
"/ ]
-"/
-"/ we keep the last source file open, because open/close
-"/ operations maybe somewhat slow on NFS-mounted file systems
-"/ Since the reference to the file is weak, it will be closed
-"/ automatically if the file is not referenced for a while. Neat trick.
+ "/ keep the last source file open, because open/close
+ "/ operations maybe slow on NFS-mounted file systems.
+ "/ Since the reference to the file is weak, it will be closed
+ "/ automatically if the file is not referenced for a while.
+ "/ Neat trick.
LastSourceFileName = source ifTrue:[
aStream := LastFileReference at:1.
].
aStream isNil ifTrue:[
- fileName := Smalltalk getSourceFileName:source.
-"/ fileName isNil ifTrue:[
-"/ fileName := source
-"/ ].
- fileName notNil ifTrue:[
- aStream := fileName asFilename readStream.
+ "/
+ "/ if there is no SourceManager, look in standard places
+ "/ first
+ "/
+ SourceCodeManager isNil ifTrue:[
+ fileName := Smalltalk getSourceFileName:source.
+ fileName notNil ifTrue:[
+ aStream := fileName asFilename readStream.
+ ].
].
aStream isNil ifTrue:[
+ "/
+ "/ nope - ask my class for the source (this also invoces the SCMgr)
+ "/
w := self who.
w notNil ifTrue:[
myClass := w at:1.
aStream := myClass sourceStream.
].
"/
- "/ final chance: try current directory
+ "/ nope - look in standard places (if there is a source-code manager)
"/
aStream isNil ifTrue:[
- aStream := source asFilename readStream.
+ SourceCodeManager notNil ifTrue:[
+ fileName := Smalltalk getSourceFileName:source.
+ fileName notNil ifTrue:[
+ aStream := fileName asFilename readStream.
+ ]
+ ].
+ "/
+ "/ final chance: try current directory
+ "/
+ aStream isNil ifTrue:[
+ aStream := source asFilename readStream.
+ ]
].
]
].
@@ -290,7 +307,7 @@
].
^ junk
- "Modified: 23.11.1995 / 01:23:48 / cg"
+ "Modified: 23.11.1995 / 15:03:25 / cg"
!
source:aString