addPathToMacOsPathd method
Implementation
bool addPathToMacOsPathd(String path) {
var success = false;
if (!isOnPATH(path)) {
final macOSPathPath = join(rootPath, 'etc', 'path.d');
try {
if (!exists(macOSPathPath)) {
createDir(macOSPathPath, recursive: true);
}
if (exists(macOSPathPath)) {
join(macOSPathPath, 'dcli').write(path);
}
success = true;
}
// ignore: avoid_catches_without_on_clauses
catch (e) {
// ignore write permission problems.
printerr(red(
"Unable to add dcli/bin to path as we couldn't write to $macOSPathPath"));
}
}
return success;
}