"use strict" ; import * as path from "path" ; import * as fs from "fs" ; import { PathResolverBase } from "./path-resolver-base" ; export class GlobalPathResolver extends PathResolverBase { protected executableFile : string ; constructor ( executable ) { super ( ) ; this . executableFile = executable ; } async resolve ( ) { let resolvedPath = null ; let pathSeparator = /^win/ . test ( process . platform ) ? ";" : ":" ; const envPath = process . env . PATH === undefined ? "" : process . env . PATH ; let globalPaths = envPath . split ( pathSeparator ) ; globalPaths . some ( ( globalPath ) => { let testPath = path . join ( globalPath , this . executableFile ) ; if ( fs . existsSync ( testPath ) ) { resolvedPath = testPath ; return true ; } return false ; } ) ; return resolvedPath === null ? "" : resolvedPath ; } }