Fixes #1373: optimized FileHelper::filterPath