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