directory detection should now work on BSDs, added AIX alternate path

This should fix #5970, #5741 and #5659