moveAside method

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

Moves the folder at path out of the way, keeping it as id until the change commits or rolls back. id is a plain folder name, as for stage, used once in a change.

Implementation

void moveAside(String id, String path) {
  _checkOpen();
  final aside = _own('${project.relativeOf(dir.path)!}/aside', id);
  final where = 'aside/$id';
  if (_aside.containsValue(where) ||
      FileSystemEntity.typeSync(aside.path, followLinks: false) !=
          FileSystemEntityType.notFound) {
    throw StateError('Something was moved aside as $id already.');
  }
  _inside(path);
  aside.parent.createSync(recursive: true);
  _aside[path] = where;
  _save();
  retryOnLock(() => project.dir(path).renameSync(aside.path));
}