Get library location automatically
Bugfix: make sure ~ is expanded in library path