зеркало из https://github.com/github/ruby.git
* enc/trans/make_transdb.rb: check foo.c only if foo.trans exists.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19068 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
797faf92d9
Коммит
5cea1b07f4
|
@ -1,3 +1,7 @@
|
|||
Tue Sep 2 20:57:14 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* enc/trans/make_transdb.rb: check foo.c only if foo.trans exists.
|
||||
|
||||
Tue Sep 2 19:19:55 2008 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* enc/trans/make_transdb.rb: error message improved.
|
||||
|
|
|
@ -11,10 +11,23 @@ converters = {}
|
|||
transdirs = ARGV.dup
|
||||
outhdr = transdirs.shift || 'transdb.h'
|
||||
transdirs << 'enc/trans' if transdirs.empty?
|
||||
|
||||
transdirs = transdirs.sort_by {|td|
|
||||
td.length
|
||||
}.inject([]) {|tds, td|
|
||||
next tds unless File.directory?(td)
|
||||
tds << td if tds.all? {|td2| !File.identical?(td2, td) }
|
||||
tds
|
||||
}
|
||||
|
||||
files = {}
|
||||
transdirs.each do |transdir|
|
||||
next unless File.directory?(transdir)
|
||||
Dir.open(transdir) {|d| d.grep(/.+\.[ch]\z/) }.sort_by {|e|
|
||||
names = Dir.entries(transdir)
|
||||
names_t = names.map {|n| /(?!\A)\.trans\z/ =~ n ? $` : nil }.compact
|
||||
names_c = names.map {|n| /(?!\A)\.c\z/ =~ n ? $` : nil }.compact
|
||||
(names_t & names_c).map {|n|
|
||||
"#{n}.c"
|
||||
}.sort_by {|e|
|
||||
e.scan(/(\d+)|(\D+)/).map {|n,a| a||[n.size,n.to_i]}.flatten
|
||||
}.each do |fn|
|
||||
next if files[fn]
|
||||
|
|
Загрузка…
Ссылка в новой задаче