Fix double slash

Only append a slash if the directory name doesn't already end with a
slash.