feat: allow other configuration files under sparo profiles

This commit is contained in:
Cheng Liu 2024-03-01 13:11:07 -08:00
parent ea8ab4cb68
commit d7f4396ffb
No known key found for this signature in database
GPG key ID: EEC8452F7DB85CD6

View file

@ -33,12 +33,18 @@ export class SparoProfileService {
});
await Async.forEachAsync(sparoProfilePaths, async (sparoProfilePath: string) => {
if (path.extname(sparoProfilePath) !== '.json') {
// No need to handle non-JSON files.
return;
}
let sparoProfile: SparoProfile | undefined;
try {
sparoProfile = await SparoProfile.loadFromFileAsync(this._terminalService, sparoProfilePath);
} catch (e) {
// TODO: more error handling
this._terminalService.terminal.writeErrorLine((e as Error).message);
this._terminalService.terminal.writeErrorLine(
`Failed to load sparo profile from ${sparoProfilePath}`
);
this._terminalService.terminal.writeDebugLine((e as Error).message);
}
if (sparoProfile) {