I haven't actually tested this, but it should work. No idea if my attempt at making it cross-platform will work either, but if the folder structure is the same it should be OK. The core works for me though, and that's what I wrote it for...
Requires Python to run python scripts.
from __future__ import print_function
import os
import sys
try: # Python 2
from urllib2 import Request
except ImportError: # Python 3
from urllib.request import Request
print('A script to download the latest DT memory layouts.')
print('Run from the same folder as the Dwarf Therapist executable.\n')
version = input('What version of DF? For 40.12, enter "12":\n ')
if sys.platform().startswith('win32'):
platform = 'windows'
memory_layout_file = 'v0.40.' + version + '_graphics.ini'
elif sys.platform().startswith('darwin'):
platform = 'osx'
memory_layout_file = 'v0.40.' + version + '_osx.ini'
elif sys.platform().startswith('linux'):
platform = 'linux'
memory_layout_file = 'v0.40.' + version + '.ini'
else:
print('Weird OS, aborting...')
raise SystemExit
DT_layout_path = 'etc/memory_layouts/'+platform+'/'
if os.path.isfile(DT_layout_path + memory_layout_file):
print('Therapist memory layout is already in place.')
else:
url = str('https://raw.githubusercontent.com/splintermind/'
'Dwarf-Therapist/DF2014/share/memory_layouts/'
+ platform + '/' + memory_layout_file)
try:
url_content = urllib.request.urlopen(url).read().decode(encoding='UTF-8')
with open(DT_layout_path + memory_layout_file, 'w') as f:
f.write(url_content)
print('DT memory layout was downloaded OK.')
except:
print('DT memory layout unavailable for this version.')