Fix a perf regression when building

Commit 8e99d3957019c8924b9f2a88ac37891be751a210 introduced a serious regression by encoding filenames within a "delete_if" block, meaning that every path in the list of all previously built files was re-encoded every time a file was built. For large projects this causes serious slowdowns - for a 4000 file test, it went from 14s to build to around 8 minutes to build. This change fixes the builder to only encode files when the file list is initially build, removing the bottleneck.