Further to pull request #225, I realised subsequently that the common code in the two `POVRay.mkPovrayImage'` functions could be returned to module `Reanimate.Povray`, and all that needed to be Windows- or Unix-like-specific was a `runPOVRay` function.
This pull request does that refactoring.
This pull request reflects code changes made to be able to use POV-Ray for Windows, Version 3.7.0.msvc10.win64.
The changes have been tested on Windows 10 but not on unix-like operating systems. However, I don't think the code for unix-like operating systems has been affected.
The reason for the changes is explained below.
1. The POV-Ray for Windows executable is named `pvengine64.exe` on 64-bit Windows, not `povray
I've created two modules `POVRay`, specified separately for `windows` and `unix`, that export `povrayApp :: String`, yielding the correct name of the executable. The function is used in place of `"povray"` (eg in `Reanimate.Driver.Check.hasPovray`).
2. Generated file names containing `$` cause problems under PowerShell, due to automatic variables, and file names on Windows are not case sensitive
I've changed the 64-character `alphabet` in `Reanimate.Cache.encodeInt` for a 32-character one which includes only capital letters and digits. This affects both Windows and unix-like operating systems. (An alternative would be versions of `encodeInt` specified differently for `windows` and `unix`.)
3. POV-Ray for Windows requires the special command line option `/EXIT` to return
I've moved `Reanimate.Povray.mkPovrayImage'` to the two modules `POVRay`. In the `windows` version, `/EXIT` is now added to the list of switches passed to the POV-Ray executable.
4. POV-Ray for Windows cannot parse switches enclosed in `""` as switches
The cause of the problem is described in more detail in the comments in the source code of module `POVRay`.
As a work around, in the `windows` version of `mkPovrayImage'`, the POV-Ray command is written to a temporary batch file and it is that batch file which is passed to `runCmd`.
Other matters
In addition to the above, POV-Ray 3.7 includes 'Script I\O Restrictions` which can prevent the writing of files. These need to be disabled in the POV-Ray for Windows GUI (under the Options menu).