changeToParentDirectory method

  1. @override
void changeToParentDirectory()
override

Changes the current working directory to the parent directory.

Implementation

@override
void changeToParentDirectory() {
  if (currentDirectory == rootDirectory) {
    throw FileSystemException("Cannot navigate above root", currentDirectory);
  }

  final parentDir = p.dirname(currentDirectory);
  if (parentDir == rootDirectory) {
    currentDirectory = rootDirectory;
  } else {
    changeDirectory(parentDir);
  }
}