More robust solution for case when package and directory structure of app are inconsistent