Get dirname of library_path if library_path is a file