refactor handling of magento_root / current directory