Localize a path to the file name based on the bsh.cwd interpreter working directory.
( String fileName )
| 1039 | working directory. |
| 1040 | */ |
| 1041 | public File pathToFile( String fileName ) |
| 1042 | throws IOException |
| 1043 | { |
| 1044 | File file = new File( fileName ); |
| 1045 | |
| 1046 | // if relative, fix up to bsh.cwd |
| 1047 | if ( !file.isAbsolute() ) { |
| 1048 | String cwd = (String)getu("bsh.cwd"); |
| 1049 | file = new File( cwd + File.separator + fileName ); |
| 1050 | } |
| 1051 | |
| 1052 | // The canonical file name is also absolute. |
| 1053 | // No need for getAbsolutePath() here... |
| 1054 | return new File( file.getCanonicalPath() ); |
| 1055 | } |
| 1056 | |
| 1057 | public static void redirectOutputToFile( String filename ) |
| 1058 | { |