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.
Merge pull request #6468 from intchanter/develop

Used a safer method to get proc_fn