summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTom Gilbert <tom@linuxbrit.co.uk>2005-07-27 16:49:34 +0000
committerTom Gilbert <tom@linuxbrit.co.uk>2005-07-27 16:49:34 +0000
commitaabe8920ae1e120587c8e27a62827d28afdc04e5 (patch)
treec4405c0e4aec14e62e0aeea101523261a9951535 /lib
parent3923613eeb0cb91abfe3f01238aeddec07573fec (diff)
rework various modules to use the installed directories
Diffstat (limited to 'lib')
-rw-r--r--lib/rbot/config.rb2
-rw-r--r--lib/rbot/language.rb5
-rw-r--r--lib/rbot/plugins.rb2
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/rbot/config.rb b/lib/rbot/config.rb
index 971a413c..f021d827 100644
--- a/lib/rbot/config.rb
+++ b/lib/rbot/config.rb
@@ -143,7 +143,7 @@ module Irc
:prompt => "Language",
:key => "core.language",
:type => :enum,
- :items => Dir.new(File.dirname(__FILE__) + "/languages/").collect {|f|
+ :items => Dir.new(@bot.datadir + "/languages").collect {|f|
f =~ /\.lang$/ ? f.gsub(/\.lang$/, "") : nil
}.compact
},
diff --git a/lib/rbot/language.rb b/lib/rbot/language.rb
index 9788b2bb..75885a51 100644
--- a/lib/rbot/language.rb
+++ b/lib/rbot/language.rb
@@ -1,10 +1,11 @@
module Irc
class Language
- def initialize(language, file="")
+ def initialize(bot, language, file="")
+ @bot = bot
@language = language
if file.empty?
- file = File.dirname(__FILE__) + "/languages/#{@language}.lang"
+ file = bot.datadir + "/languages/#{@language}.lang"
end
unless(FileTest.exist?(file))
raise "no such language: #{@language} (no such file #{file})"
diff --git a/lib/rbot/plugins.rb b/lib/rbot/plugins.rb
index 5db047fb..d239c5e6 100644
--- a/lib/rbot/plugins.rb
+++ b/lib/rbot/plugins.rb
@@ -170,7 +170,7 @@ module Irc
# load plugins from pre-assigned list of directories
def scan
dirs = Array.new
- dirs << File.dirname(__FILE__) + "/plugins"
+ dirs << @bot.datadir + "/plugins"
dirs += @dirs
dirs.each {|dir|
if(FileTest.directory?(dir))