Bug fixes for convert.rb

This commit is contained in:
Sourav Goswami
2020-08-24 02:25:45 +05:30
parent 5e4bb6431c
commit 250e0419aa

View File

@@ -1,5 +1,6 @@
#!/usr/bin/ruby -w #!/usr/bin/ruby -w
# Frozen_String_Literal: true # Frozen_String_Literal: true
require 'fileutils'
REPLACE = "#4E81ED".upcase.freeze REPLACE = "#4E81ED".upcase.freeze
BASE = File.join(__dir__, 'oreo_base_cursors') BASE = File.join(__dir__, 'oreo_base_cursors')
@@ -7,6 +8,8 @@ CONFIG_FILE = 'colours.conf'
### Code ### ### Code ###
puts "index.theme not found under #{BASE}" unless Dir.children(BASE).include?('index.theme')
colours = {} colours = {}
hex = (?0..?9).to_a + (?a..?f).to_a << ?# hex = (?0..?9).to_a + (?a..?f).to_a << ?#
@@ -56,9 +59,12 @@ colours.each do |x, y|
Dir.glob("#{BASE}/*.svg").each do |z| Dir.glob("#{BASE}/*.svg").each do |z|
if File.file?(z) if File.file?(z)
dest_file = File.join(dirname, File.basename(z))
data = IO.read(z) data = IO.read(z)
r.each { |c| data.gsub!(c, y) } r.each { |c| data.gsub!(c, y) }
IO.write(File.join(dirname, File.basename(z)), data) IO.write(dest_file, data)
end end
end end
FileUtils.cp("#{BASE}/index.theme", dirname)
end end