MCPcopy Index your code
hub / github.com/coder/mux / resolveRealPathAllowMissing

Function resolveRealPathAllowMissing

src/node/services/tools/skillFileUtils.ts:109–131  ·  view source on GitHub ↗
(targetPath: string)

Source from the content-addressed store, hash-verified

107}
108
109async function resolveRealPathAllowMissing(targetPath: string): Promise<string> {
110 const missingSegments: string[] = [];
111 let currentPath = targetPath;
112
113 while (true) {
114 try {
115 const realPath = await fsPromises.realpath(currentPath);
116 return missingSegments.length === 0 ? realPath : path.join(realPath, ...missingSegments);
117 } catch (error) {
118 if (!hasErrorCode(error, "ENOENT")) {
119 throw error;
120 }
121
122 const parentPath = path.dirname(currentPath);
123 if (parentPath === currentPath) {
124 throw error;
125 }
126
127 missingSegments.unshift(path.basename(currentPath));
128 currentPath = parentPath;
129 }
130 }
131}
132
133export async function resolveContainedSkillFilePath(
134 skillDir: string,

Callers 2

ensurePathContainedFunction · 0.85

Calls 2

hasErrorCodeFunction · 0.85
basenameMethod · 0.45

Tested by

no test coverage detected