diff options
author | Matthias Hecker <apoc@sixserv.org> | 2014-03-05 14:05:03 +0100 |
---|---|---|
committer | Matthias Hecker <apoc@sixserv.org> | 2014-03-05 14:05:03 +0100 |
commit | b955d424d89655a04ba5f06d3cfee482ae33e713 (patch) | |
tree | 80191825ec680a2beaf5c49b86d7db44fa3d6a5f /lib | |
parent | 6760a5d2f56cb9aceece5183cc0e3dfc619b60d2 (diff) |
[registry] migrate tc directory name to registry_tc
Diffstat (limited to 'lib')
-rw-r--r-- | lib/rbot/ircbot.rb | 1 | ||||
-rw-r--r-- | lib/rbot/registry.rb | 12 |
2 files changed, 13 insertions, 0 deletions
diff --git a/lib/rbot/ircbot.rb b/lib/rbot/ircbot.rb index b954e3b5..8b827f15 100644 --- a/lib/rbot/ircbot.rb +++ b/lib/rbot/ircbot.rb @@ -504,6 +504,7 @@ class Bot end @registry_factory = Registry.new @config['core.db'] + @registry_factory.migrate_registry_folder(path) @logfile = @config['log.file'] if @logfile.class!=String || @logfile.empty? 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 |