问题描述
不知道有没有办法在 VSCode 中拆分一些变量?
我的例子会更好地解释我的问题:
我在这样的路径中有一个 exe
文件 C:\path\to\workspace\main\project\project.exe
my cpp
将创建 exe
文件的源路径是这个 C:\path\to\workspace\main\project\test.cpp
我想在 tasks.json
中创建一个 task
但我的变量没有给我正确的路径
如你所知:${workspaceFolder}
是 C:\path\to\workspace
${fileDirname}
返回 C:\path\to\workspace\main\project
和 ${relativeFileDirname}.exe
返回 main\project.exe
和 "${fileDirname}\\${relativeFileDirname}.exe"
的组合作为命令将返回 C:\path\to\workspace\main\project\main\project.exe
那是错误的.
所以我想知道是否还有其他变量只返回当前 file
的 parent
或不返回?
如果 not
可以用 \
分割变量吗?
我希望它有意义
谢谢
请参阅https://github.com/microsoft/vscode/commit/551db7ec94f02a4bdc8999092cf8bef642b3992d>
${fileDirnameBasename}
正在被添加到 vscode v1.52,我相信这就是你正在寻找的.p>
I wonder there is any way to splitting some variables in VSCode?
my example will explain my question better:
I have an exe
file in such path C:\path\to\workspace\main\project\project.exe
my cpp
source path that will create exe
file is this C:\path\to\workspace\main\project\test.cpp
I want to create a task
in tasks.json
but my oder of variables does not give me the right path
as you understand:${workspaceFolder}
is C:\path\to\workspace
${fileDirname}
returns C:\path\to\workspace\main\project
and ${relativeFileDirname}.exe
returns main\project.exe
and combination of "${fileDirname}\\${relativeFileDirname}.exe"
as a command will return C:\path\to\workspace\main\project\main\project.exe
that is wrong.
so I wanted to know there is any other variable that just return the parent
of current file
or not?
if not
can we split variables with \
?
I hope it makes some sense
thanks
see https://github.com/microsoft/vscode/commit/551db7ec94f02a4bdc8999092cf8bef642b3992d
${fileDirnameBasename}
is being added to vscode v1.52 which I believe is what you are looking for.
这篇关于有没有办法在 VSCode 中拆分变量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!