Quantcast
Channel: Active questions tagged visual-studio-code - Stack Overflow
Viewing all articles
Browse latest Browse all 97355

Path with double backslash in VS-Code Task

$
0
0

I want to create a VS-Code Task, that executs a R command to convert markdown into PDF. My current Task looks like this:

{
    "label": "rmarkdown -> pdf",
    "type": "process",
    "command": "Rscript",
    "args": ["-e", "\"rmarkdown::render('${file}', 'pdf_document')\""],
    "windows": true,
    "presentation": {
        "reveal": "always",
        "panel": "new"
    }
}

The problem ist, that ${file} returns a path like this:

d:\data\documents\myFile.md

but R needs a path with escaped backslashs like this:

d:\\data\\documents\\myFile.md

how to get a escaped path from ${file}?

Alternative a path with normal slashs will do the job as well, because R will automaticaly replace / to \\.


Viewing all articles
Browse latest Browse all 97355

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>