application/window.c

changeset 59
6bd37fe6d905
parent 57
d5a7dbc945ef
equal deleted inserted replaced
58:0d25f15e2625 59:6bd37fe6d905
293 293
294 294
295 cxmutstr base = cx_strdup(cx_strn(full_path, end)); 295 cxmutstr base = cx_strdup(cx_strn(full_path, end));
296 cxmutstr base_path = cx_strcat(2, cx_strcast(base), CX_STR("/")); 296 cxmutstr base_path = cx_strcat(2, cx_strcast(base), CX_STR("/"));
297 cxstring path = cx_strsubs(fpath, end + skip); 297 cxstring path = cx_strsubs(fpath, end + skip);
298
299 cxstring trail = cx_str(len > 0 && full_path[len-1] == '/' ? "/" : "");
298 300
299 cxstring *pathelms; 301 cxstring *pathelms;
300 size_t nelm = 0; 302 size_t nelm = 0;
301 303
302 if (path.length > 0) { 304 if (path.length > 0) {
329 cxmutstr m = cx_strdup(c); 331 cxmutstr m = cx_strdup(c);
330 elms[j].name = m.ptr; 332 elms[j].name = m.ptr;
331 elms[j].name_len = m.length; 333 elms[j].name_len = m.length;
332 334
333 size_t elm_path_len = c.ptr + c.length - full_path; 335 size_t elm_path_len = c.ptr + c.length - full_path;
334 cxmutstr elm_path = cx_strcat(2, cx_strn(full_path, elm_path_len), CX_STR("/")); 336 cxmutstr elm_path = cx_strcat(2, cx_strn(full_path, elm_path_len), i+1 < nelm ? CX_STR("/") : trail);
335 elms[j].path = elm_path.ptr; 337 elms[j].path = elm_path.ptr;
336 elms[j].path_len = elm_path.length; 338 elms[j].path_len = elm_path.length;
337 339
338 j++; 340 j++;
339 } 341 }

mercurial