Fix when -d option ends with a /

Signed-off-by: Bao Haojun <baohaojun@gmail.com>