MCPcopy Create free account
hub / github.com/microsoft/vscode-cpptools / removePathPrefix

Function removePathPrefix

Extension/gulpfile.js:71–90  ·  view source on GitHub ↗
(path, prefix)

Source from the content-addressed store, hash-verified

69const translationExtensionName = "vscode-cpptools";
70
71function removePathPrefix(path, prefix) {
72 if (!prefix) {
73 return path;
74 }
75 if (!path.startsWith(prefix)) {
76 return path;
77 }
78 if (path === prefix) {
79 return "";
80 }
81 let ch = prefix.charAt(prefix.length - 1);
82 if (ch === '/' || ch === '\\') {
83 return path.substring(prefix.length);
84 }
85 ch = path.charAt(prefix.length);
86 if (ch === '/' || ch === '\\') {
87 return path.substring(prefix.length + 1);
88 }
89 return path;
90}
91
92const dataLocIdAttribute = "data-loc-id";
93const dataLocHintAttribute = "data-loc-hint";

Callers 5

processHtmlFilesFunction · 0.85
processJsonSchemaFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected