MCPcopy Index your code
hub / github.com/nodejs/node / getRelativePath

Function getRelativePath

lib/internal/vfs/router.js:30–40  ·  view source on GitHub ↗
(normalizedPath, mountPoint)

Source from the content-addressed store, hash-verified

28// `path.relative()` so Windows backslash paths are handled correctly, then
29// re-joins with forward slashes for the provider's internal POSIX format.
30function getRelativePath(normalizedPath, mountPoint) {
31 if (normalizedPath === mountPoint) {
32 return '/';
33 }
34 if (mountPoint === '/') {
35 return normalizedPath;
36 }
37 const rel = relative(mountPoint, normalizedPath);
38 const segments = StringPrototypeSplit(rel, sep);
39 return '/' + ArrayPrototypeJoin(segments, '/');
40}
41
42module.exports = {
43 isUnderMountPoint,

Callers 2

#toProviderPathMethod · 0.70
test-vfs-router.jsFile · 0.50

Calls 1

relativeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…