get_ref_dir(): add function for getting a ref_dir from a ref_entry