Skip to content

Commit

Permalink
Fix os_path_join for case where dirname is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
isaachier authored and andrewrk committed Jun 26, 2018
1 parent 3290e72 commit 8e71428
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/os.cpp
Expand Up @@ -225,6 +225,11 @@ void os_path_extname(Buf *full_path, Buf *out_basename, Buf *out_extname) {
}

void os_path_join(Buf *dirname, Buf *basename, Buf *out_full_path) {
if (buf_len(dirname) == 0) {
buf_init_from_buf(out_full_path, basename);
return;
}

buf_init_from_buf(out_full_path, dirname);
uint8_t c = *(buf_ptr(out_full_path) + buf_len(out_full_path) - 1);
if (!os_is_sep(c))
Expand Down

0 comments on commit 8e71428

Please sign in to comment.