121 // for comparison, we need the current base_url/repo_name + path |
121 // for comparison, we need the current base_url/repo_name + path |
122 size_t len = path ? strlen(path) : 0; |
122 size_t len = path ? strlen(path) : 0; |
123 if (len == 1 && *path == '/') { |
123 if (len == 1 && *path == '/') { |
124 path = ""; |
124 path = ""; |
125 } |
125 } |
|
126 |
|
127 // check if the new path is a prefix of the current path |
|
128 // if not, we have to set the pathbar string to the new path |
126 char *full_path = util_concat_path(browser->repo_base, path); |
129 char *full_path = util_concat_path(browser->repo_base, path); |
127 // compare new path with current path |
130 char *full_path_col = util_concat_path(full_path, "/"); |
128 // in theory we could always set path, but maybe this is faster |
|
129 char *current_path = ui_get(browser->path); |
131 char *current_path = ui_get(browser->path); |
130 if (strcmp(full_path, current_path)) { |
132 cxstring cpath = cx_str(current_path); |
|
133 cxstring newc = cx_str(full_path_col); |
|
134 if (!cx_strprefix(cpath, newc)) { |
131 ui_set(browser->path, full_path); |
135 ui_set(browser->path, full_path); |
132 } |
136 } |
133 free(full_path); |
137 free(full_path); |
|
138 free(full_path_col); |
134 |
139 |
135 DavBrowserQueryPath *query = malloc(sizeof(DavBrowserQueryPath)); |
140 DavBrowserQueryPath *query = malloc(sizeof(DavBrowserQueryPath)); |
136 query->pool = browser->dav_queue; |
141 query->pool = browser->dav_queue; |
137 query->browser = browser; |
142 query->browser = browser; |
138 query->path = strdup(path); |
143 query->path = strdup(path); |