Used a safer method to get proc_fn

Previously, this called get_proc_dir(), which clears the contents of the
specified directory, resulting in issue #6238.