Skip to content

Instantly share code, notes, and snippets.

@jaynetics
Created March 26, 2018 07:40
Show Gist options
  • Save jaynetics/edf1dd8bc0799e19bbb5919af825cf25 to your computer and use it in GitHub Desktop.
Save jaynetics/edf1dd8bc0799e19bbb5919af825cf25 to your computer and use it in GitHub Desktop.
script to switch out heroes chronicles data (tarnum graphics) in a homm 3 installation
#!/usr/bin/env ruby
FILES = %w[
HPL003sh.pcx
HPL004sh.pcx
HPL006kn.pcx
hpl007sh.pcx
HPL102br.pcx
hpl112bs.pcx
HPS003sh.pcx
HPS004sh.pcx
HPS006kn.pcx
hps007sh.pcx
HPS102br.pcx
hps112bs.pcx
]
BACKUP_DIR = __dir__ + '/Tarnum/'
LIVE_DIR = __dir__ + '/Data/'
def move(files, from:, to:)
files.each { |file| File.rename(from + file, to + file) }
end
if File.exist?(BACKUP_DIR + '/' + FILES.first)
print 'Moving Tarnum files to LIVE dir ... '
move(FILES, from: BACKUP_DIR, to: LIVE_DIR)
else
print 'Moving Tarnum files to BACKUP dir ... '
move(FILES, from: LIVE_DIR, to: BACKUP_DIR)
end
puts 'done!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment