Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve file related ${} variable in tasks to have appropriate slash for shell #84016

Closed
liukai234 opened this issue Nov 6, 2019 · 4 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues
Milestone

Comments

@liukai234
Copy link

liukai234 commented Nov 6, 2019

In the development of C + + in vscode under Windows version, the file separator in ${file} ,etc. is \, while in Bash is /, which will cause that the development of C + + cannot be compiled after vscode uses bash integrated terminal.

@liukai234 liukai234 changed the title File separator in $file in C + + extension of vscode in Windows version is incompatible with bash File separator in ${file},etc. in C + + extension of vscode in Windows version is incompatible with bash Nov 6, 2019
@alexdima
Copy link
Member

alexdima commented Nov 6, 2019

@liukai234 In what file are you using the ${file}?

@alexdima alexdima added the info-needed Issue requires more information from poster label Nov 6, 2019
@liukai234
Copy link
Author

@liukai234 In what file are you using the ${file}?
The code is all of task.js,task.js is generated by the C / C + + extension, ${file} in line 20 of the code snippet

{
    // https://go.microsoft.com/fwlink/?LinkId=733558
    "version": "2.0.0",
    "tasks": [
        {
            "type": "shell",
            "label": "gcc.exe build active file",
            "presentation": {
                "echo": false,
                "reveal": "never",
                "focus": false,
                "panel": "shared",
                "showReuseMessage": false,
                "clear": true
            },
            "command": "D:\\Program Files\\mingw64\\bin\\gcc.exe",
            "args": [
                "-g",
                "${file}", // This ${file} and second line below ${fileDirname}, ${fileBasenameNoExtension}
                "-o",
                "${fileDirname}\\${fileBasenameNoExtension}.exe"
            ],
            "options": {
                "cwd": "D:\\Program Files\\mingw64\\bin"
            },
            "problemMatcher": [
                "$gcc"
            ],
            "group": {
                "kind": "build",
                "isDefault": true
            }
        }
    ]
}

@alexr00
Copy link
Member

alexr00 commented Nov 6, 2019

Sort of a duplicate of #38381, but we can probably be better about resolving variables to have a slash that is correct for bash.

@alexr00 alexr00 changed the title File separator in ${file},etc. in C + + extension of vscode in Windows version is incompatible with bash Resolve file related ${} variable in tasks to have appropriate slash for shell Nov 6, 2019
@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug tasks Task system issues and removed info-needed Issue requires more information from poster labels Nov 6, 2019
@alexr00 alexr00 added this to the On Deck milestone Nov 6, 2019
@tdjastrzebski
Copy link

IMHO only forward slashes in path parameters should be allowed and used.
Windows supports them since long, long time ago.

@vscodebot vscodebot bot locked and limited conversation to collaborators Feb 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug tasks Task system issues
Projects
None yet
Development

No branches or pull requests

4 participants