MCPcopy
hub / github.com/compiler-explorer/compiler-explorer / check_path

Function check_path

lib/assert.ts:53–61  ·  view source on GitHub ↗
(parent: string, directory: string)

Source from the content-addressed store, hash-verified

51
52// Explicitly export for testing purposes - not part of the public API
53export function check_path(parent: string, directory: string) {
54 // https://stackoverflow.com/a/45242825/15675011
55 const relative = path.relative(parent, directory);
56 if (relative && !relative.startsWith('..') && !path.isAbsolute(relative)) {
57 // Normalize separators to forward slashes for consistent behavior across platforms
58 return normalizePath(relative);
59 }
60 return false;
61}
62
63// Explicitly export for testing purposes - not part of the public API
64export function get_diagnostic() {

Callers 2

get_diagnosticFunction · 0.85
assert-tests.tsFile · 0.85

Calls 1

normalizePathFunction · 0.85

Tested by

no test coverage detected