|
From: | Paolo Bonzini |
Subject: | Re: [Help-smalltalk] Including files |
Date: | Sun, 03 Sep 2006 20:50:04 +0200 |
User-agent: | Thunderbird 1.5.0.5 (Macintosh/20060719) |
That's because most likely the stream you're using is a readline stream. For a file-in, your very clever expression works.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....
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
[Prev in Thread] | Current Thread | [Next in Thread] |