Build problem when using cabal sandboxes

The build script assumes that `dist/` is the output path, but when built using cabal in a sandbox the output path is something like `dist/dist-sandbox-da44256f`. The fix is to get the actual output path from the parameters passed in from cabal.