Support windows exe extension and path separator
flatten nested logic