Vscode task & emscripten

1.1k views Asked by At

I've created a custom task that compile my "C" files with emscripten, but the output files are saved at the root of my workspace. I would like to change this, so the compiled files are saved in the same directory as my input js file

My task.json file:

{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"command": "echo",
"args": ["Hello World"],
"tasks": [
    {
        "taskName": "Emscripten + HTML",
        "type": "shell",
        "command": "emcc ${file} -o ${fileBasename}.html" 
    },
    {
        "taskName": "Emscripten + Webassemby + html",
        "type": "shell",
        "command": "emcc ${file} -s WASM=1 -o ${fileBasename}.html"
    }
]
}
1

There are 1 answers

1
Tripurari Shankar On BEST ANSWER

in output file name instead of ${fileBasename}.html

use ${fileDirname}/${fileBasename}.htm