marrub
/
Lithia
Archived
1
0
Fork 0
This repository has been archived on 2023-06-17. You can view files and clone it, but cannot push or open issues/pull-requests.
Lithia/hashfs.rb

19 lines
478 B
Ruby

#!/usr/bin/env ruby
## Copyright © 2018 Graham Sanderson, all rights reserved.
## HashFS: Compile a directory structure into an enumerated list.
require 'fileutils'
it = 0
base = "pk/graphics/"
of = open('pk/language.gfx.txt', 'w')
of.puts('[enu default]')
Dir.glob 'graphics/**/*.png' do |item|
to = sprintf("LITHX%.3i", it)
of.puts "\"LITH:#{/lgfx\/(.+)\.png/.match(item)[1].gsub('/', ':')}\" = \"#{to}\";"
FileUtils.copy item, base + to + ".png"
it += 1
end