appendToPATH method

void appendToPATH(
  1. String newPath
)

Appends newPath to the list of paths in the PATH environment variable.

If newPath is already in PATH no action is taken.

Changing the PATH has no affect on the parent process (shell) that launched this script.

Changing the path affects the current script and any children that it spawns.

See: prependToPATH removeFromPATH

Implementation

void appendToPATH(String newPath) {
  if (!isOnPATH(newPath)) {
    final path = PATH..add(newPath);
    _setEnv('PATH', path.join(delimiterForPATH));
  }
}