Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Expand functionality of fileExists function with executable check #2230

Merged
merged 2 commits into from
Jan 8, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions src/goPath.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,13 @@ function correctBinname(toolName: string) {
}

function fileExists(filePath: string): boolean {
let flag = true;
try {
return fs.statSync(filePath).isFile();
fs.accessSync(filePath, fs.constants.F_OK | fs.constants.X_OK);
} catch (e) {
return false;
flag = false;
}
return flag;
}

export function clearCacheForTools() {
Expand Down