425
return absoluteLocations.map(l => l.uri);
426
}
428
>
// locations in the settings can contain glob patterns so we need
429
>
// to process them to get "clean" paths; the goal here is to have
430
>
// a list of unambiguous folder paths where prompt files are stored
431
>
const result = new ResourceSet();
432
>
for (const absoluteLocation of absoluteLocations) {
433
>
let location = absoluteLocation.uri;
434
>
const baseName = basename(location);
435
>
436
>
// if a path ends with a well-known "any file" pattern, remove
437
>
// it so we can get the dirname path of that setting value
438
>
const filePatterns = ['*.md', `*${getPromptFileExtension(type)}`];
439
>
for (const filePattern of filePatterns) {
440
>
if (baseName === filePattern) {
441
>
location = dirname(location);
442
>
continue;
443
>
}
444
>
}
445
>
446
>
// likewise, if the pattern ends with single `*` (any file name)
447
>
// remove it to get the dirname path of the setting value
448
>
if (baseName === '*') {
449
>
location = dirname(location);
450
>
}
451
>
452
>
// if after replacing the "file name" glob pattern, the path
453
>
// still contains a glob pattern, then ignore the path
454
>
if (isValidGlob(location.path) === true) {
455
>
continue;
456
>
}
457
>
458
>
result.add(location);
459
>
}
460
>
461
>
return [...result];
462
}
463