Properly get main file and make bib completion work on windows