MCPcopy Create free account
hub / github.com/backnotprop/plannotator / normalizeUserPathInput

Function normalizeUserPathInput

packages/shared/resolve-file.ts:88–111  ·  view source on GitHub ↗
(
	input: string,
	platform = process.platform,
)

Source from the content-addressed store, hash-verified

86}
87
88export function normalizeUserPathInput(
89 input: string,
90 platform = process.platform,
91): string {
92 const trimmedInput = input.trim();
93 const unquotedInput = stripWrappingQuotes(trimmedInput);
94 const expandedInput = expandHomePath(unquotedInput);
95
96 if (platform !== "win32") {
97 return expandedInput;
98 }
99
100 for (const pattern of WINDOWS_DRIVE_PATH_PATTERNS) {
101 const match = expandedInput.match(pattern);
102 if (!match) {
103 continue;
104 }
105
106 const [, driveLetter, rest] = match;
107 return `${driveLetter.toUpperCase()}:/${rest}`;
108 }
109
110 return expandedInput;
111}
112
113function isAbsoluteNormalizedUserPath(
114 input: string,

Callers 5

isAbsoluteUserPathFunction · 0.85
resolveUserPathFunction · 0.85
resolveCodeFileFunction · 0.85
resolveMarkdownFileCoreFunction · 0.85

Calls 2

stripWrappingQuotesFunction · 0.85
expandHomePathFunction · 0.85

Tested by

no test coverage detected