Refactored: Deduplicate code for searching files in folders of %PATH%

Signed-off-by: Sven Strickroth <email@cs-ware.de>