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

Function absolutePath

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

* Computes the absolute path to for the given path relative to the provided base directory. * If either `path` or `baseDir` are `file:` URLs, they are converted to local paths.

(path: string, baseDir = process.cwd())

Source from the content-addressed store, hash-verified

236 * If either `path` or `baseDir` are `file:` URLs, they are converted to local paths.
237 */
238 absolutePath(path: string, baseDir = process.cwd()): string {
239 if (!path) {
240 return this.normalizePath(baseDir);
241 }
242
243 if (!isAbsolute(path) && !path.startsWith('file://')) {
244 path = baseDir + '/' + path;
245 }
246
247 return this.normalizePath(path);
248 },
249
250 async readFile(path: string): Promise<string> {
251 return nodeReadFile(path, 'utf-8');

Callers

nothing calls this directly

Calls 1

normalizePathMethod · 0.80

Tested by

no test coverage detected