cd method

void cd(
  1. String name
)

Change directory to subfolder name. It will be created if it does not exist. If it is a file, the parent folder will be returned. Returns the new path.

Implementation

void cd(String name) {
  if (isFile) {
    // Do nothing
  } else {
    String path = '$_path\\$name';
    // Check if path exists
    Directory dir = Directory(path);
    if (!dir.existsSync()) {
      // Create path
      dir.createSync(recursive: true);
    }
    _path = dir.path;
  }
}