use `basename` and `realpath`