changeDirectory method

void changeDirectory(
  1. String dirname
)

Implementation

void changeDirectory(String dirname) {
  String fullPath = _getFullPath(dirname);
  if (!_isPathAllowed(fullPath)) {
    sendResponse('550 Access denied');
    return;
  }

  var newDir = Directory(fullPath);
  if (newDir.existsSync()) {
    currentDirectory = newDir.path;
    sendResponse('250 Directory changed to $currentDirectory');
  } else {
    sendResponse('550 Directory not found $fullPath');
  }
}