#!/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