prependToPATH method
Prepends newPath
to the list of paths in the
PATH environment variable provided the
path isn't already on the PATH.
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.
Implementation
void prependToPATH(String newPath) {
if (!isOnPATH(newPath)) {
final path = PATH..insert(0, newPath);
_setEnv('PATH', path.join(delimiterForPATH));
}
}