file: Fix `join_path` to handle paths ending with a slash.