Skip to content

Instantly share code, notes, and snippets.

@mjkoo
Last active August 8, 2020 09:04
Show Gist options
  • Save mjkoo/0eb70888b6085b3f65f5 to your computer and use it in GitHub Desktop.
Save mjkoo/0eb70888b6085b3f65f5 to your computer and use it in GitHub Desktop.
Install Civ 5 Enhanced UI Mod on Linux
#!/usr/bin/env python2
# NOTE: Use of this script is deprecated, instead I recommend you use
#
# $ unzip -LL eui_v1_20.zip -d "$HOME/.steam/steam/SteamApps/common/Sid Meier's Civilization V/steamassets/assets/dlc"
#
# to make use of the unzip command's built-in conversion to lowercase filenames
# (thanks reddit user /u/xkero and github user Mfdas)
import os
import shutil
import sys
import tempfile
import zipfile
# Verify this is the right path on your system
DLC_DIR = '~/.steam/steam/SteamApps/common/Sid Meier\'s Civilization V/steamassets/assets/dlc'
EUI_DIR = 'UI_bc1'
if __name__ == '__main__':
# Quick and dirty argument parsing
if len(sys.argv) != 2:
print 'Usage: %s [ZIPFILE]' % sys.argv[0]
sys.exit(-1)
eui_zipfile = sys.argv[1]
try:
tempdir = tempfile.mkdtemp()
with zipfile.ZipFile(sys.argv[1], 'r') as zf:
zf.extractall(tempdir)
srcdir = os.path.join(tempdir, EUI_DIR)
dstdir = os.path.join(os.path.expanduser(DLC_DIR), EUI_DIR.lower())
shutil.copytree(srcdir, dstdir)
os.chdir(dstdir)
for root, dirnames, filenames in os.walk('.', topdown=False):
for filename in dirnames + filenames:
orig = os.path.join(root, filename)
new = orig.lower()
try:
os.renames(orig, new)
except:
pass
finally:
if tempdir:
shutil.rmtree(tempdir)
@chrys-the-flower
Copy link

I'm not sure if this is the right place for this, but a much easier way to do this would just unzip the original EUI zip using 'unzip -LL eui_zip.zip' which automatically forces conversion of every directory and filename to lowercase.

@mjkoo
Copy link
Author

mjkoo commented Mar 4, 2016

Thanks for the comment Mfdas, noted in comments. Definitely a better way to do it, this was discussed in the reddit thread as well.

@rpdelaney
Copy link

This also seems to work (after extracting):

convmv --lower -r -f UTF-8 --notest UI_bc1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment