8944476c94edd2adc685844993bf972b80e9a50f
[chise/ruby.git] / chise / config.rb
1 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
2
3 require "singleton"
4
5 module CHISE
6   def windows?()
7     rp = RUBY_PLATFORM
8     rp.index("cygwin") || rp.index("mswin32") || rp.index("mingw32")
9   end
10   module_function :windows?
11
12   class Config
13     include Singleton
14
15     def initialize
16       @base_dir = File.expand_path(File.dirname(__FILE__)+"/../..")
17       @csf_dir = @base_dir+"/csf"
18
19       if CHISE.windows?()
20         @db_dir  = @base_dir+"/chise-db" # /sysmtem-char-id/=ucs
21         @ids_dir = @base_dir+"/ids" # /IDS-JIS-X0208-1990.txt
22       else
23         @db_dir  = "/usr/local/lib/xemacs-21.4.14/i686-pc-linux/chise-db"
24         @ids_dir = "/home/eto/work/chise/ids"
25       end
26
27       instance_variables.each {|name|
28         self.class.class_eval { attr_reader name.delete("@") }
29       }
30     end
31   end
32 end