rename method

StoreDirectory rename(
  1. String storeName
)

Rename the store directory synchronously

The old StoreDirectory will still retain it's link to the old store, so always use the new returned value instead: returns a new StoreDirectory after a successful renaming operation.

Implementation

StoreDirectory rename(String storeName) {
  final String safe = filesystemSanitiseValidate(
    inputString: storeName,
    throwIfInvalid: true,
  );

  if (safe != _storeDirectory.storeName) {
    _access.real.renameSync(
      p.joinAll([_storeDirectory.rootDirectory.access.real.path, safe]),
    );
  }

  return _storeDirectory.copyWith(storeName: safe);
}