| 406 skip++; // skip first '/' |
406 skip++; // skip first '/' |
| 407 } |
407 } |
| 408 |
408 |
| 409 |
409 |
| 410 cxmutstr base = cx_strdup(cx_strn(full_path, end)); |
410 cxmutstr base = cx_strdup(cx_strn(full_path, end)); |
| 411 cxmutstr base_path = cx_strcat(2, cx_strcast(base), CX_STR("/")); |
411 cxmutstr base_path = cx_strcat(2, cx_strcast(base), cx_str("/")); |
| 412 cxstring path = cx_strsubs(fpath, end + skip); |
412 cxstring path = cx_strsubs(fpath, end + skip); |
| 413 |
413 |
| 414 cxstring trail = cx_str(len > 0 && full_path[len-1] == '/' ? "/" : ""); |
414 cxstring trail = cx_str(len > 0 && full_path[len-1] == '/' ? "/" : ""); |
| 415 |
415 |
| 416 cxstring *pathelms; |
416 cxstring *pathelms; |
| 417 size_t nelm = 0; |
417 size_t nelm = 0; |
| 418 |
418 |
| 419 if (path.length > 0) { |
419 if (path.length > 0) { |
| 420 nelm = cx_strsplit_a(cxDefaultAllocator, path, CX_STR("/"), 4096, &pathelms); |
420 nelm = cx_strsplit_a(cxDefaultAllocator, path, cx_str("/"), 4096, &pathelms); |
| 421 if (nelm == 0) { |
421 if (nelm == 0) { |
| 422 *ret_nelm = 0; |
422 *ret_nelm = 0; |
| 423 return NULL; |
423 return NULL; |
| 424 } |
424 } |
| 425 } |
425 } |
| 446 cxmutstr m = cx_strdup(c); |
446 cxmutstr m = cx_strdup(c); |
| 447 elms[j].name = m.ptr; |
447 elms[j].name = m.ptr; |
| 448 elms[j].name_len = m.length; |
448 elms[j].name_len = m.length; |
| 449 |
449 |
| 450 size_t elm_path_len = c.ptr + c.length - full_path; |
450 size_t elm_path_len = c.ptr + c.length - full_path; |
| 451 cxmutstr elm_path = cx_strcat(2, cx_strn(full_path, elm_path_len), i+1 < nelm ? CX_STR("/") : trail); |
451 cxmutstr elm_path = cx_strcat(2, cx_strn(full_path, elm_path_len), i+1 < nelm ? cx_str("/") : trail); |
| 452 elms[j].path = elm_path.ptr; |
452 elms[j].path = elm_path.ptr; |
| 453 elms[j].path_len = elm_path.length; |
453 elms[j].path_len = elm_path.length; |
| 454 |
454 |
| 455 j++; |
455 j++; |
| 456 } |
456 } |