MCPcopy Index your code
hub / github.com/VSpaceCode/VSpaceCode / relativePathToWorkspace

Function relativePathToWorkspace

src/pathCommands.ts:127–132  ·  view source on GitHub ↗

* 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)

Source from the content-addressed store, hash-verified

125 * So we can handle the case if we are remoting into a Windows machine from *nix.
126 */
127function relativePathToWorkspace(uri: Uri) {
128 const folder = workspace.getWorkspaceFolder(uri);
129 return folder
130 ? relativePath(folder.uri, uri) ?? uriToFsPath(uri)
131 : uriToFsPath(uri);
132}
133
134function dirname(fsPath: string, path: PlatformPath) {
135 return path.dirname(fsPath) + path.sep;

Callers 1

_getPathFunction · 0.85

Calls 2

relativePathFunction · 0.85
uriToFsPathFunction · 0.85

Tested by

no test coverage detected