library scanning: always use a trailing slash for readdir