1 # Copyright (C) 2002-2004 Kouichirou Eto, All rights reserved.
3 $LOAD_PATH.unshift("..")
12 class DataBaseManagement
15 path = cd.location+"character/feature"
18 ft = cd.get_feature(f)
24 f = f.path.escape.escape_win_filename
31 out.printf("%s\t%s\n", k, v)
42 file = get_filename(t)
43 open("#{file}.txt", "w"){|out|
44 # out.binmode.sync = true
46 ar.map! {|k, v| [to_num(k), to_num(v)] }
48 out.printf("%s\t%s\n", k, v)
55 class DataBaseFileManagement
57 # from specs/char-atr.ja.txt
84 ancient-char-of-shinjigen-1
86 original-char-of-shinjigen-1
88 vulgar-char-of-shinjigen-1
90 variant-of-shinjigen-1
96 # @opt = {:noop=>true, :verbose=>true}
97 @opt = {:verbose=>true}
100 def move_obsolete_files
101 fpath = Config.instance.db_dir.path+"system-char-id"
103 opath = "obsolete".path
104 opath.mkdir unless opath.directory?
106 OBSOLETE_FEATURES.each {|attr|
109 f = f.normalize_filename
110 FileUtils.mv(f.to_s, opath.to_s, @opt) if f.exist?
112 FileUtils.mv(f.to_s, opath.to_s, @opt) if f.exist?
118 path = Config.instance.db_dir.path
120 nfpath = path+"character/feature"
121 FileUtils.mkdir_p(nfpath.to_s, @opt) unless nfpath.directory?
123 fpath = path+"system-char-id"
124 fpath.each_entry {|f|
126 FileUtils.mv((fpath+f).to_s, nfpath.to_s, @opt)
129 ncpath = path+"character/by_feature"
130 FileUtils.mkdir_p(ncpath.to_s, @opt) unless ncpath.directory?
134 next if f.to_s == "character"
136 next unless d.directory?
137 ff = d + "system-char-id"
139 FileUtils.mv(ff.to_s, (ncpath+f).to_s, @opt)