If is always preferred to if/else, unless if gets less efficient than if/else.

The cleanest here IMHO would be avoiding introducing "ret" var and just using resolved_path which is there anyway.