Refs #8270 Add checking for valid working directory.
Refs #8270 Correct function and add comment.
Merge remote-tracking branch 'origin/bugfix/8270_bayes_dir_path_crash'