dav/scfg.c

changeset 66
f8c1f685e08e
parent 65
d4077e8175f3
child 75
56962faf2b42
equal deleted inserted replaced
65:d4077e8175f3 66:f8c1f685e08e
158 } else { 158 } else {
159 regex_t *matchnothing = malloc(sizeof(regex_t)); 159 regex_t *matchnothing = malloc(sizeof(regex_t));
160 regcomp(matchnothing, "///", REG_NOSUB); 160 regcomp(matchnothing, "///", REG_NOSUB);
161 dir->exclude = ucx_list_append(NULL, matchnothing); 161 dir->exclude = ucx_list_append(NULL, matchnothing);
162 } 162 }
163 if (trash) { 163
164 if (trash && sstrtrim(sstr(trash)).length > 0) {
164 if (trash[0] == '/') { 165 if (trash[0] == '/') {
165 dir->trash = strdup(trash); 166 dir->trash = strdup(trash);
166 } else { 167 } else {
167 char *t = util_concat_path(path, trash); 168 char *t = util_concat_path(path, trash);
168 dir->trash = util_concat_path(t, "/"); 169 dir->trash = util_concat_path(t, "/");
174 if (util_mkdir(dir->trash, mode)) { 175 if (util_mkdir(dir->trash, mode)) {
175 if (errno != EEXIST) { 176 if (errno != EEXIST) {
176 fprintf(stderr, "Cannot create trash directory.\n"); 177 fprintf(stderr, "Cannot create trash directory.\n");
177 } 178 }
178 } 179 }
180 } else {
181 dir->trash = NULL;
179 } 182 }
180 183
181 ucx_map_cstr_put(directories, name, dir); 184 ucx_map_cstr_put(directories, name, dir);
182 185
183 return 0; 186 return 0;

mercurial