* Compute the closest relative path of the input uri to the workspace folder(s). * * When there are no workspace folders or when the path * is not contained in them, the input is returned. * * This similar to the `workspace.asRelativePath` that the relative path is always * going to use `/`. H
(uri: Uri)
| 125 | * So we can handle the case if we are remoting into a Windows machine from *nix. |
| 126 | */ |
| 127 | function relativePathToWorkspace(uri: Uri) { |
| 128 | const folder = workspace.getWorkspaceFolder(uri); |
| 129 | return folder |
| 130 | ? relativePath(folder.uri, uri) ?? uriToFsPath(uri) |
| 131 | : uriToFsPath(uri); |
| 132 | } |
| 133 | |
| 134 | function dirname(fsPath: string, path: PlatformPath) { |
| 135 | return path.dirname(fsPath) + path.sep; |
no test coverage detected