Fix data directory detection logic to allow in-the-tree build