From b955d424d89655a04ba5f06d3cfee482ae33e713 Mon Sep 17 00:00:00 2001 From: Matthias Hecker Date: Wed, 5 Mar 2014 14:05:03 +0100 Subject: [registry] migrate tc directory name to registry_tc --- lib/rbot/registry.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib/rbot/registry.rb') diff --git a/lib/rbot/registry.rb b/lib/rbot/registry.rb index 799e69ee..0eefc9da 100644 --- a/lib/rbot/registry.rb +++ b/lib/rbot/registry.rb @@ -83,6 +83,18 @@ class Registry @@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 -- cgit v1.2.3