Fix the root output directory when cleaning examples

This forgot to take into account the logic from some other locations, so I added
a helper method!

Closes #912
auto merge of #918 : alexcrichton/cargo/issue-912, r=brson

This forgot to take into account the logic from some other locations, so I added
a helper method!

Closes #912