Assert.notNull(directory, "Addon repository directory must not be null.");
AddonRepository repository = AddonRepositoryImpl.forDirectory(this, directory);
if (mode.isImmutable())
repository = new ImmutableAddonRepository(repository);
return addRepository(repository);
}