Created
March 26, 2018 07:40
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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