MCPcopy Create free account
hub / github.com/mikro-orm/mikro-orm / relativePath

Function relativePath

packages/core/src/utils/fs-utils.ts:218–232  ·  view source on GitHub ↗

* Determines the relative path between two paths. If either path is a `file:` URL, * it is converted to a local path.

(path: string, relativeTo: string)

Source from the content-addressed store, hash-verified

216 * it is converted to a local path.
217 */
218 relativePath(path: string, relativeTo: string): string {
219 if (!path) {
220 return path;
221 }
222
223 path = this.normalizePath(path);
224
225 if (path.startsWith('.')) {
226 return path;
227 }
228
229 path = relative(this.normalizePath(relativeTo), path);
230
231 return this.normalizePath(path);
232 },
233
234 /**
235 * Computes the absolute path to for the given path relative to the provided base directory.

Callers

nothing calls this directly

Calls 1

normalizePathMethod · 0.80

Tested by

no test coverage detected