moveIn method

void moveIn(
  1. String id,
  2. String path
)

Moves the folder staged as id to path, which must not exist.

Implementation

void moveIn(String id, String path) {
  _checkOpen();
  final staged = _own(staging, id);
  if (FileSystemEntity.typeSync(staged.path, followLinks: false) !=
      FileSystemEntityType.directory) {
    throw StateError('Nothing is staged as $id.');
  }
  _inside(path);
  final target = project.dir(path);
  target.parent.createSync(recursive: true);
  if (target.existsSync()) {
    throw StateError('$path already exists.');
  }
  _movedIn.add(path);
  _save();
  retryOnLock(() => staged.renameSync(target.path));
}