Prevent duplicate files in source list.
Combine two if statements
Support windows exe extension and path separator
flatten nested logic