Dynamically get BASE_DIR from path