refactor output file name generation
Merge pull request #1513 from WalterBright/b17

refactor output file name generation