# (the configured one) accessor implementation, we can just assume
# it to be the correct accessor to use.
cls = AbstractAccessor.get_impl.first
- cls.new(File.join(path, 'registry_' + @format, filename.downcase))
+ db = cls.new(File.join(path, 'registry_' + @format, filename.downcase))
+ db.optimize
+ db
end
# Helper method that will return a list of supported registry formats.
@@formats ||= Registry.new.discover
end
+ # Will detect tokyocabinet registry location: ~/.rbot/registry/*.tdb
+ # and move it to its new location ~/.rbot/registry_tc/*.tdb
+ def migrate_registry_folder(path)
+ old_name = File.join(path, 'registry')
+ new_name = File.join(path, 'registry_tc')
+ if @format == 'tc' and File.exists?(old_name) and
+ not File.exists?(new_name) and
+ not Dir.glob(File.join(old_name, '*.tdb')).empty?
+ File.rename(old_name, new_name)
+ end
+ end
+
# Abstract database accessor (a hash-like interface).
class AbstractAccessor