POSIX basename may modify the parameter. So, it is simpler to make "path magic" by myself.