Improving the add-ons generator to deal with apps (bug 1080145)

Cancel and replace PR#320
`+ 1`? Did you want to avoid using `0` and forgot the `start` part of the range?