PageRenderTime 4ms CodeModel.GetById 1ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/jEdit/tags/jedit-4-5-pre1/org/gjt/sp/jedit/bsh/commands/sourceRelative.bsh

#
Unknown | 21 lines | 18 code | 3 blank | 0 comment | 0 complexity | d1fd4a8fcb3fe557a4095234f698e276 MD5 | raw file
 1/**
 2    Source a file relative to the callering script's directory.
 3	<p/>
 4
 5    e.g. scripts A running in dir A sources script B in dir B.
 6	Script B can use this command to load additional scripts (data, etc.)
 7	relative to its own location (dir B) without having to explicitly know 
 8	its "home" directory (B).
 9	<p/>
10	Note: this only works for files currently.
11
12    @since bsh1.3
13	@see source( file | URL );
14*/
15sourceRelative( String file )
16{
17    this.dir=dirname( getSourceFileInfo() );
18    this.path=pathToFile( dir + File.separator + file ) .getAbsolutePath();
19    return this.interpreter.source( path, this.caller.namespace );
20}
21