Also there may be a way to get the current filename that I am missing.
 thisContext method methodSourceFile doesn't seem to have it, which
isn't that surprising....
That's because most likely the stream you're using is a readline stream. For a file-in, your very clever expression works.

I'm not sure I like hacking into #fileIn:, on the other hand a method like FileStream class>#include: might be much better:

include: aFileName
   | callerName dir fullName |
   callerName := thisContext parentContext method methodSourceFile.
   callerName isNil ifTrue: [ FileStream fileIn: aFileName asString ].
   dir := (File name: callerName) stripFileName.
   fullName := Directory append: aFileName to: dir.
   FileStream fileIn: aFileName!

or something like that.

Paolo




_______________________________________________
help-smalltalk mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-smalltalk

Reply via email to