Skip to content

Commit e42a39e

Browse files
committed
Look for either .dbinfo or codeql-database.yml
1 parent bd22878 commit e42a39e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

extensions/ql-vscode/src/databaseFetcher.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export async function databaseFetcher(
5757
step: 3
5858
});
5959

60-
const dbPath = await findDirWithFile(unzipPath, '.dbinfo');
60+
const dbPath = await findDirWithFile(unzipPath, '.dbinfo', 'codeql-database.yml');
6161
if (dbPath) {
6262
// might need to upgrade before importing...
6363
const item = await databasesManager.openDatabase(Uri.parse(dbPath));
@@ -149,17 +149,17 @@ function isFile(databaseUrl: string) {
149149
*
150150
* @returns the directory containing the file, or undefined if not found.
151151
*/
152-
async function findDirWithFile(dir: string, toFind: string): Promise<string | undefined> {
152+
async function findDirWithFile(dir: string, ...toFind: string[]): Promise<string | undefined> {
153153
if (!(await fs.stat(dir)).isDirectory()) {
154154
return;
155155
}
156156
const files = await fs.readdir(dir);
157-
if (files.includes(toFind)) {
157+
if (toFind.some(file => files.includes(file))) {
158158
return dir;
159159
}
160160
for (const file of files) {
161161
const newPath = path.join(dir, file);
162-
const result = await findDirWithFile(newPath, toFind);
162+
const result = await findDirWithFile(newPath, ...toFind);
163163
if (result) {
164164
return result;
165165
}

0 commit comments

Comments
 (0)