/jEdit/tags/jedit-4-3-pre6/bsh/commands/rm.bsh

# · Unknown · 21 lines · 15 code · 6 blank · 0 comment · 0 complexity · a507a6565951722d8c7c10bdda6dc69b MD5 · raw file

  1. /**
  2. Remove a file (like Unix rm).
  3. */
  4. bsh.help.rm = "usage: cd( path )";
  5. boolean rm( String pathname )
  6. {
  7. this.file = pathToFile( pathname );
  8. if ( file == null )
  9. throw new java.io.FileNotFoundException("pathname");
  10. if ( file.isDirectory() ) {
  11. print( pathname + "is a directory" );
  12. return;
  13. }
  14. return file.delete();
  15. }