Skip to content

Commit

Permalink
Check TRAP directory exists first
Browse files Browse the repository at this point in the history
  • Loading branch information
henrymercer committed Aug 31, 2022
1 parent 9552903 commit 8e0846c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 23 deletions.
21 changes: 11 additions & 10 deletions lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

27 changes: 15 additions & 12 deletions src/analyze-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,18 +108,21 @@ function hasBadExpectErrorInput(): boolean {
function doesGoExtractionOutputExist(config: Config): boolean {
const golangDbDirectory = util.getCodeQLDatabasePath(config, Language.go);
const trapDirectory = path.join(golangDbDirectory, "trap", Language.go);
return fs
.readdirSync(trapDirectory)
.some((fileName) =>
[
".trap",
".trap.gz",
".trap.br",
".trap.tar.gz",
".trap.tar.br",
".trap.tar",
].some((ext) => fileName.endsWith(ext))
);
return (
fs.existsSync(trapDirectory) &&
fs
.readdirSync(trapDirectory)
.some((fileName) =>
[
".trap",
".trap.gz",
".trap.br",
".trap.tar.gz",
".trap.tar.br",
".trap.tar",
].some((ext) => fileName.endsWith(ext))
)
);
}

/**
Expand Down

0 comments on commit 8e0846c

Please sign in to comment.