LUCENE-5376: move the hack wtf into one place

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5376@1553499 13f79535-47bb-0310-9956-ffa450edef68
LUCENE-5376: don't create and destroy dirs in the CWD

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5376@1553500 13f79535-47bb-0310-9956-ffa450edef68