]> git.sven.stormbind.net Git - sven/vym.git/blob - scripts/make-qrc.rb
Import Upstream version 2.6.11
[sven/vym.git] / scripts / make-qrc.rb
1 #!/usr/bin/ruby
2 #
3 # Simple script to generate the resource file
4 # So far only png images are considered
5
6 require 'find'
7 require 'pathname'
8
9 outfile = 'vym.qrc'
10 subdirs = ['flags','icons']
11
12 content = "<!DOCTYPE RCC><RCC version=\"1.0\">\n"
13 content << "  <qresource>\n"
14 subdirs.each do |dir|
15   Find.find(dir) do |path|
16     # Create alias using the name of the subdir within dir
17     abs_path  = Pathname.new( File.expand_path( path) )
18     root_path = Pathname.new( File.expand_path( dir ) )
19     rel_path  = abs_path.relative_path_from( root_path )
20     
21     if path =~ /.*\.png$/
22       content << "    <file alias=\"#{rel_path.to_s}\">#{path}</file>\n" 
23     end
24   end
25 end
26 content << "  </qresource>"
27 content << "</RCC>"
28
29 File.write(outfile, content)