MCPcopy Create free account
hub / github.com/compiler-explorer/compiler-explorer / maskRootdir

Function maskRootdir

lib/utils.ts:106–118  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

104 * note: will keep /app/ if instead of filepath something like '-I/tmp/path' is used
105 */
106export function maskRootdir(filepath: string): string {
107 if (filepath) {
108 if (process.platform === 'win32') {
109 // todo: should also use temp_prefix here
110 return filepath
111 .replace(/^C:\/Users\/[\w\d-.]*\/AppData\/Local\/Temp\/compiler-explorer-compiler[\w\d-.]*\//, '/app/')
112 .replace(/^\/app\//, '');
113 }
114 const re = getRegexForTempdir();
115 return filepath.replace(re, '/app/').replace(/^\/app\//, '');
116 }
117 return filepath;
118}
119
120export function changeExtension(filename: string, newExtension: string): string {
121 const lastDot = filename.lastIndexOf('.');

Callers 3

parseOutputFunction · 0.85

Calls 1

getRegexForTempdirFunction · 0.85

Tested by

no test coverage detected