MCPcopy Create free account
hub / github.com/agegr/pi-web / normalizeFilePathSlashes

Function normalizeFilePathSlashes

lib/file-paths.ts:1–6  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

1export function normalizeFilePathSlashes(filePath: string): string {
2 if (/^[a-zA-Z]:[\\/]/.test(filePath) || filePath.startsWith("\\\\")) {
3 return filePath.replace(/\\/g, "/");
4 }
5 return filePath;
6}
7
8export function encodeFilePathForApi(filePath: string): string {
9 return normalizeFilePathSlashes(filePath)

Callers 7

TreeNodeFunction · 0.90
FileExplorer.tsxFile · 0.90
encodeFilePathForApiFunction · 0.70
getFileNameFunction · 0.70
getFileDirectoryFunction · 0.70
getRelativeFilePathFunction · 0.70
joinFilePathFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected