isOnPATH method

bool isOnPATH(
  1. String checkPath
)

returns true if the given checkPath is in the list of paths defined in the environment variable PATH.

Implementation

bool isOnPATH(String checkPath) {
  final canon = canonicalize(truepath(checkPath));
  var found = false;
  for (final path in _path) {
    if (canonicalize(truepath(path)) == canon) {
      found = true;
      break;
    }
  }
  return found;
}