updateWorkingDirectory method

void updateWorkingDirectory(
  1. String newDirectory
)

Updates the working directory of the current context.

This creates a new context with the updated directory.

Implementation

void updateWorkingDirectory(String newDirectory) {
  final current = _stack.removeLast();
  _stack.add(
    ExecutionContext(
      workingDirectory: newDirectory,
      sourceFile: current.sourceFile,
      recordToSession: current.recordToSession,
      silent: current.silent,
      parent: current.parent,
    )
      ..multilineMode = current.multilineMode
      ..multilineBuffer.addAll(current.multilineBuffer),
  );
}