/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
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- /**
- Source a file relative to the callering script's directory.
- <p/>
- e.g. scripts A running in dir A sources script B in dir B.
- Script B can use this command to load additional scripts (data, etc.)
- relative to its own location (dir B) without having to explicitly know
- its "home" directory (B).
- <p/>
- Note: this only works for files currently.
- @since bsh1.3
- @see source( file | URL );
- */
- sourceRelative( String file )
- {
- this.dir=dirname( getSourceFileInfo() );
- this.path=pathToFile( dir + File.separator + file ) .getAbsolutePath();
- return this.interpreter.source( path, this.caller.namespace );
- }