Please try one more thing, add the following two line just below Result := mrOk(TPublisher.CopyAFile).
Pos() works and AnsiStartsStr(), but the right place is method DoFileFound. You already had a test there but it was wrong.
I fixed it in r58878. I also removed the now obsolete define. (So no pause for me ...)
GetMem and howardpc, how come you were not able to reproduce the recursion problem?
Did you not test with projects having many directory levels, some of them above the project main dir? GetMem did such tests earlier I guess.
Can't you reproduce the problem even with my test project?
Many directory levels has been the challenge all the time. The old original code already was able to include all files from a flat project directory.
Hopefully the publish project feature will become bug free soon.
Now it is bug free, at least for projects!
Must test packages more later.