PageRenderTime 64ms CodeModel.GetById 62ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-2-pre14/bsh/commands/getSourceFileInfo.bsh

#
Unknown | 27 lines | 23 code | 4 blank | 0 comment | 0 complexity | 5b4dda10704bd62d8a2def99f0fb287c MD5 | raw file
 1/**
 2	Return the name of the file or source from which the current interpreter
 3	is reading.  Note that if you use this within a method, the result will
 4	not be the file from which the method was sourced, but will be the file 
 5	that the caller of the method is reading.   Methods are sourced once but
 6	can be called many times... Each time the interpreter may be associated
 7	with a different file and it is that calling interpreter that you are
 8	asking for information.
 9	<p>
10
11	Note: although it may seems like this command would always return the
12	getSourceFileInfo.bsh file, it does not since it is being executed after
13	sourcing by the caller's interpreter.
14	If one wanted to know the file from which a bsh method was sourced one
15	would have to either capture that info when the file was sourced (by
16	saving the state of the getSourceFileInfo() in a variable outside of
17	the method or more generally we could add the info to the BshMethod class
18	so that bsh methods remember from what source they were created...
19*/
20
21bsh.help.getSourceFileInfo = "usage: getSourceFileInfo()";
22
23import bsh.Interpreter;
24
25getSourceFileInfo() {
26	return this.interpreter.getSourceFileInfo();
27}