The evils of CD
CD/pushd/popd are evil
String filePath = join(HOME, 'directory', 'file.txt');
String dartPath = join('/', 'usr', 'lib', 'bin', 'dart');
// absolute path to your current working directory.
String current = absolute('.');
// create a safe path by replacing the segments (..) with the real path.
String safe = canonicalize(join('..', '..', 'hacker'));
String dirname = dirname(join('usr', 'lib', 'fred.text'));
assert(dirname == '/usr/lib');Why is cd dangerous?
Last updated
Was this helpful?