Changed readFile to java-based read function to handle \r\n, fixes docs and test, lite still broken

This commit is contained in:
Jörn Zaefferer 2006-10-08 09:57:17 +00:00
parent c26ae24a1b
commit 0121530083
3 changed files with 14 additions and 2 deletions

View file

@ -2,7 +2,7 @@ load("build/js/json.js", "build/js/xml.js", "build/js/writeFile.js", "build/js/p
var dir = arguments[1];
var c = parse( readFile(arguments[0]) );
var c = parse( read(arguments[0]) );
output( c, "docs" );
c = categorize( c );

View file

@ -5,3 +5,15 @@ function writeFile( file, stream ) {
buffer.print( stream );
buffer.close();
}
function read( file ) {
var jq = new File(file);
var reader = new BufferedReader(new FileReader(jq));
var line = null;
var buffer = new java.lang.StringBuffer(jq.length());
while( (line = reader.readLine()) != null) {
buffer.append(line);
buffer.append("\n");
}
return buffer.toString();
}

View file

@ -16,7 +16,7 @@ function addTestWrapper(name, test) {
}
var dir = arguments[1];
var jq = parse( readFile( arguments[0] ) );
var jq = parse( read(arguments[0]) );
var testFile = [];