本文介绍了希望$ {workspaceFolder}在Windows上发出正斜杠吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在task.json中配置VSCode任务,我需要将$ {workspaceFolder}传递给'make'命令,但是它必须是正斜杠,而不是反斜杠.

I'm configuring a VSCode task in tasks.json, and I need to pass the ${workspaceFolder} to a 'make' command, however it needs to be forward slashes, not back slashes.

{
"version": "2.0.0",
"echoCommand": true,
"tasks": [
    {
        "label": "build",
        "type": "shell",
        "group": {
            "kind": "build",
            "isDefault": true
        },
        "command": "make",
        "args": [
            "APPDIR=\"${workspaceFolder}\""
        ]
. . .

在Windows上是否可以修改$ {workspaceFolder}以发出正斜杠?或者,是否存在诸如宏之类的东西,我可以在其中搜索和替换?

Is there any way to modify ${workspaceFolder} to emit forward slashes on Windows?Or, is there such a thing as a macro, where I can search and replace?

我的根本问题是GNU make似乎避开了来自APPDIR的反斜杠,例如:C:\ somedirectory \ someotherdirectory \ athirddirectory.我以为如果可以改用正斜杠,那就可以解决此问题.我无法控制Make文件,也无法编辑.

My root issue is that GNU make seems to escape the backslashes incoming from APPDIR, for example: C:\somedirectory\someotherdirectory\athirddirectory.I thought if I could switch to forward slashes, it would fix the issue.I have no control over, and cannot edit, the make file.

谢谢

-约翰

推荐答案

使用扩展名extension.commandvariable.workspace.workspaceFolderPosix ="nofollow noreferrer">命令变量,其中您需要带斜杠的${workspaceFolder}.此扩展程序中还有其他有用的替代方法.

Use variable extension.commandvariable.workspace.workspaceFolderPosix from extension command-variable where you need ${workspaceFolder} with forward slashes. There are also other useful substitutions in this extension.

这篇关于希望$ {workspaceFolder}在Windows上发出正斜杠吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 17:04