Vscode-php-debug: File not found - Mac client with Windows IIS server

Created on 13 Jul 2018  路  2Comments  路  Source: xdebug/vscode-php-debug

PHP version: 7.0
XDebug version: php_xdebug-2.6.0-7.0-vc14-nts.dll

launch.json

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Debug",
            "type": "php",
            "request": "launch",
            "port": 9000,
            "pathMappings": {
                "c:\\inetpub\\mamobile dev\\mamobile": "${workspaceFolder}"
            }
        }
    ]
}

Problem:
VSCode cannot find files because the path is incorrect. I believe this is because I am using a mac as a client debugger with the host being a windows IIS server.

screen-shot-2018-07-12-at-5 47 58-pm

/Users/hackmodford/Code/PHPStorm Projects/ma-mobile-webservice/routes\Inventory.php (incorrect path in message)
/Users/hackmodford/Code/PHPStorm Projects/ma-mobile-webservice/routes/Inventory.php (path of file in vscode)
/Users/hackmodford/Code/PHPStorm Projects/ma-mobile-webservice/routes/Inventory.php (path in FS)

Looks like the paths.ts needs to be fixed to address this.

Most helpful comment

Adding this to line 48 of paths.ts solves the problem for me. However, I am no typescript expert, so I imagine there is a better solution?

if (serverIsWindows && !isWindowsUri(localPath)) {
        //Change all the backslashes to forward slashes.
        let re = /\\/gi;
        localPath = localPath.replace(re, "/");
}

All 2 comments

This seems to be related to #216

Adding this to line 48 of paths.ts solves the problem for me. However, I am no typescript expert, so I imagine there is a better solution?

if (serverIsWindows && !isWindowsUri(localPath)) {
        //Change all the backslashes to forward slashes.
        let re = /\\/gi;
        localPath = localPath.replace(re, "/");
}
Was this page helpful?
0 / 5 - 0 ratings

Related issues

luxifer picture luxifer  路  3Comments

NerijusNoreika picture NerijusNoreika  路  12Comments

evs-xsarus picture evs-xsarus  路  5Comments

herbertpimentel picture herbertpimentel  路  6Comments

jmo161 picture jmo161  路  4Comments