changeDirectory method

  1. @override
void changeDirectory(
  1. String path
)
override

Changes the current working directory to the specified path. Implementations must handle path resolution and update the internal state correctly.

Implementation

@override
void changeDirectory(String path) {
  final targetPath = resolvePath(path);
  final dir = Directory(targetPath);
  if (!dir.existsSync() ||
      FileSystemEntity.typeSync(targetPath) !=
          FileSystemEntityType.directory) {
    throw FileSystemException(
        "Directory not found or not a directory: $path (resolved to $targetPath)",
        path);
  }
  currentDirectory = targetPath;
}