Added optional appDir option to don't depend on the cwd.