Okay, here's roughly how it's done in Python:h.g.muller wrote:If you would let your wrapper read the string it feeds to system() from a file with a fixed name (say wrapper.ini) in the current directory, people could use it without comiling anything. They would only have to prepare an ini file with the wine command in it. Of course you could have the wrapper also supply the path to wine by itself and just read the path to the engine from the file. Or, to accomodate even more lazy users, let it construct the engine path from the current directory and the .exe name read from the wrapper.ini file.
Code: Select all
#!/usr/bin/env python
# Run this in the directory with the Win32 UCI .exe or a parent
# directory of it.
#
# Command: uciloader[.py] <win32_uci_exe_filename>
from distutils.spawn import find_executable
import os
import os.path
import subprocess
import sys
name = sys.argv[1]
curdir = os.path.abspath(".")
winexec = find_executable("wine")
winepath = os.path.abspath(winexec)
def uciengine(name, curdir):
for root, dirs, files in os.walk(curdir):
if name in files:
return os.path.join(root, name)
# Need to update this to use subprocess instead of os.system:
os.system("{0} {1}".format(winepath, uciengine(name, curdir)))