Refactor add_path for clarity and extensibility

When Who What
2022-10-12 05:46:12 Michael Paquier (michael-kun) Closed in commitfest 2022-09 with status: Returned with feedback
2022-10-02 16:59:02 Andres Freund (andresfreund) New status: Waiting on Author
2022-08-01 21:34:38 Jacob Champion (jchampion) Closed in commitfest 2022-07 with status: Moved to next CF
2022-03-24 13:27:12 Nils Dijk (nilsdijk) Added annotation "Latest patch is actually attached to my email, not the one shown in the commitfest app" to CAECUgYygh8GT=yduiRX6vr5yVUt65=Aq29C-kQ+DMUjsCpL=Cw@mail.gmail.com
2022-03-24 13:16:56 Dimitri Fontaine (dim) Changed authors to Nils Dijk (nilsdijk)
2022-03-24 13:15:04 Nils Dijk (nilsdijk) Attached mail thread CAOP8fzYM3fhisZ1exZOZmjF8LA5Zo+XFLDFk2o6qOiuUHs62fg@mail.gmail.com
2022-03-24 13:15:03 Nils Dijk (nilsdijk) Created patch record