Clean up work/log/pid dir implementations and fix Windows build.