(dir: string)
| 44 | } |
| 45 | |
| 46 | function loadExtensionsFromDir(dir: string): Extension[] { |
| 47 | const extensionsDir = path.join(dir, EXTENSIONS_DIRECTORY_NAME); |
| 48 | if (!fs.existsSync(extensionsDir)) { |
| 49 | return []; |
| 50 | } |
| 51 | |
| 52 | const extensions: Extension[] = []; |
| 53 | for (const subdir of fs.readdirSync(extensionsDir)) { |
| 54 | const extensionDir = path.join(extensionsDir, subdir); |
| 55 | |
| 56 | const extension = loadExtension(extensionDir); |
| 57 | if (extension != null) { |
| 58 | extensions.push(extension); |
| 59 | } |
| 60 | } |
| 61 | return extensions; |
| 62 | } |
| 63 | |
| 64 | function loadExtension(extensionDir: string): Extension | null { |
| 65 | if (!fs.statSync(extensionDir).isDirectory()) { |
no test coverage detected