mirror of
https://github.com/i-net-software/JWebAssembly.git
synced 2025-03-25 07:27:52 +01:00
fix file name of JavaScript output with text output format.
This commit is contained in:
parent
20d2b7f44e
commit
9faeb626a9
@ -125,7 +125,7 @@ public class WasmTarget implements Closeable {
|
|||||||
@Nonnull
|
@Nonnull
|
||||||
public Writer getSourceMapOutput() throws IOException {
|
public Writer getSourceMapOutput() throws IOException {
|
||||||
if( sourceMap == null && file != null ) {
|
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;
|
return sourceMap;
|
||||||
}
|
}
|
||||||
@ -139,11 +139,25 @@ public class WasmTarget implements Closeable {
|
|||||||
*/
|
*/
|
||||||
public Writer getJavaScriptOutput() throws IOException {
|
public Writer getJavaScriptOutput() throws IOException {
|
||||||
if( javaScript == null && file != null && file.isFile() ) {
|
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;
|
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
|
* Close all streams
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user