authorgravatar for isaachier@gmail.comIsaac Hier <isaachier@gmail.com> 2018-06-24 20:27:18-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2018-06-26 13:31:32-04:00
log8e714289cac55fd6f793cf21cea5fa1930edb985
tree7c620720e7d8b061828710b7382926ed7ccfc8b8
parent3290e728339e49765b1adda78f173befb9fc12bf

Fix os_path_join for case where dirname is empty


1 files changed, 5 insertions(+), 0 deletions(-)

src/os.cpp+5
...@@ -225,6 +225,11 @@ void os_path_extname(Buf *full_path, Buf *out_basename, Buf *out_extname) {...@@ -225,6 +225,11 @@ void os_path_extname(Buf *full_path, Buf *out_basename, Buf *out_extname) {
225}225}
226226
227void os_path_join(Buf *dirname, Buf *basename, Buf *out_full_path) {227void os_path_join(Buf *dirname, Buf *basename, Buf *out_full_path) {
228 if (buf_len(dirname) == 0) {
229 buf_init_from_buf(out_full_path, basename);
230 return;
231 }
232
228 buf_init_from_buf(out_full_path, dirname);233 buf_init_from_buf(out_full_path, dirname);
229 uint8_t c = *(buf_ptr(out_full_path) + buf_len(out_full_path) - 1);234 uint8_t c = *(buf_ptr(out_full_path) + buf_len(out_full_path) - 1);
230 if (!os_is_sep(c))235 if (!os_is_sep(c))