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

Function initialize

lib/properties.ts:137–151  ·  view source on GitHub ↗
(directory: string, hier: string[])

Source from the content-addressed store, hash-verified

135}
136
137export function initialize(directory: string, hier: string[]) {
138 if (hier === null) throw new Error('Must supply a hierarchy array');
139 hierarchy = hier.map((x: string) => x.toLowerCase());
140 logger.info(`Reading properties from ${directory} with hierarchy ${hierarchy}`);
141 const endsWith = /\.properties$/;
142 const propertyFiles = fs.readdirSync(directory).filter(filename => filename.match(endsWith));
143 properties = {};
144 for (let file of propertyFiles) {
145 const baseName = file.replace(endsWith, '');
146 file = path.join(directory, file);
147 debug('Reading config from ' + file);
148 properties[baseName] = parseProperties(fs.readFileSync(file, 'utf8'), file);
149 }
150 logger.debug('props.properties = ', properties);
151}
152
153export function reset() {
154 hierarchy = [];

Callers

nothing calls this directly

Calls 3

debugFunction · 0.85
parsePropertiesFunction · 0.85
matchMethod · 0.80

Tested by

no test coverage detected