Extract standalone path expansion to do it only once
Merge pull request #3044 from Juanxo/extract-standalone-path-expansion

Extract standalone path expansion to do it only once