SpiritQuaddicted/QuakeInjector — pull request #1 by neogeographica (2014-04-08 20:49:45+00:00)
Title: set engine process working directory to exe home directory

## functional changes

Previously the code was setting the working directory to be the basedir
(directory containing the id1 folder etc.) which is usually kosher but not
always.

This change sets the engine working directory to instead be the directory
actually containing the engine executable. If the engine is in the basedir
then nothing changes. New cases that will now work (that didn't) are cases
where the engine is not in the basedir, when the engine tries to find stuff
like DLLs or other resources that it expects to be in (or relative to) the
working directory.

A couple of examples of the engine not being in the basedir:

- DarkPlaces has so many libraries that I usually like to corral all its files
into their own folder (and use the -basedir command line arg).

- Using Steam.exe to launch Quake through Steam (cf. comments 124-126 at
http://www.celephais.net/board/view_thread.php?id=60441 ).

## code changes

The main change is in EngineStarter.start, where we now use
quakeExe.getParentFile() as the working directory.

This means that EngineStarter no longer needs to know about the basedir
(previously passed in as quakeDir) -- that's only used when managing packages,
and when constructing the quakeExe arg. So the other changes are to remove
that now-unused bit of state from EngineStarter.