fix file name of JavaScript output with text output format.

This commit is contained in:
Volker Berlin 2019-08-08 18:23:44 +02:00
parent 20d2b7f44e
commit 9faeb626a9

View File

@ -125,7 +125,7 @@ public class WasmTarget implements Closeable {
@Nonnull
public Writer getSourceMapOutput() throws IOException {
if( sourceMap == null && file != null ) {
sourceMap = new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream( file + ".map" ) ), StandardCharsets.UTF_8 );
sourceMap = new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream( getBaseWasmFile() + ".wasm.map" ) ), StandardCharsets.UTF_8 );
}
return sourceMap;
}
@ -139,11 +139,25 @@ public class WasmTarget implements Closeable {
*/
public Writer getJavaScriptOutput() throws IOException {
if( javaScript == null && file != null && file.isFile() ) {
javaScript = new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream( file + ".js" ) ), StandardCharsets.UTF_8 );
javaScript = new OutputStreamWriter( new BufferedOutputStream( new FileOutputStream( getBaseWasmFile() + ".wasm.js" ) ), StandardCharsets.UTF_8 );
}
return javaScript;
}
/**
* Get the base name without extension.
*
* @return the base file name
*/
private String getBaseWasmFile() {
String name = file.toString();
int idx = name.lastIndexOf( '.' );
if( idx > 0 ) {
name = name.substring( 0, idx );
}
return name;
}
/**
* Close all streams
*