Better way to resolve dir