[WFCORE-171] Validate the file is not an existing directory before setting the file on a file-handler

The first commit cleans up the way the subsystem was retrieving the `PathManager`. After my initial testing of the fix for WFCRORE-171 I realized this commit is actually needed for the fix. It is however cleaner than how it was handled before.

The second commit checks that a file is not a directory which results results in errors on the logmanager side, but indicates the operation was successful.