auto-detect base path