MCPcopy Create free account
hub / github.com/sourcebot-dev/sourcebot / resolvePathRelativeToConfig

Function resolvePathRelativeToConfig

packages/backend/src/utils.ts:26–37  ·  view source on GitHub ↗
(localPath: string, configPath: string)

Source from the content-addressed store, hash-verified

24}
25
26export const resolvePathRelativeToConfig = (localPath: string, configPath: string) => {
27 let absolutePath = localPath;
28 if (!path.isAbsolute(absolutePath)) {
29 if (absolutePath.startsWith('~')) {
30 absolutePath = path.join(process.env.HOME ?? '', absolutePath.slice(1));
31 }
32
33 absolutePath = path.resolve(path.dirname(configPath), absolutePath);
34 }
35
36 return absolutePath;
37}
38
39export const arraysEqualShallow = <T>(a?: readonly T[], b?: readonly T[]) => {
40 if (a === b) return true;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected