Dynamic lib directory detection