116 fsm_iter = fsm_iter->
next)
126 return fsentry->
path;
131 if ((!fsentry->
path || !path || !
STREQ(path, fsentry->
path)) && (fsentry->
path != path)) {
141 if (user_config_dir.has_value()) {
150 return (fsentry->
icon) ? fsentry->
icon : ICON_FILE_FOLDER;
155 fsentry->
icon = icon;
177 if (fsentry->
name[0]) {
178 return fsentry->
name;
182 char *name = fsentry->
name + 1;
183 size_t name_size =
sizeof(fsentry->
name) - 1;
193 size_t tmp_name_size =
sizeof(tmp_name);
196 if (!name[0] ||
STREQ(tmp_name, name)) {
198 fsentry->
name[0] =
'\0';
207 if (user_config_dir.has_value()) {
216 if (fsentry->
path && fsentry->
path[0]) {
221 const char *exceptions[] = {
"A:\\",
"B:\\",
nullptr};
222 const size_t exceptions_len[] = {strlen(exceptions[0]), strlen(exceptions[1]), 0};
225 for (
i = 0; exceptions[
i];
i++) {
227 fsentry->
valid =
true;
235 fsentry->
valid =
false;
244 fsm_iter = fsm_iter->
next)
249 return fsm_iter ? fsm_iter->
save : 0;
259 const uint path_len = strlen(path);
265 const bool has_trailing_slash = (path[path_len - 1] ==
SEP);
273 for (fsm_iter = fsm_head; fsm_iter; fsm_prev = fsm_iter, fsm_iter = fsm_iter->
next) {
274 if (fsm_iter->
path) {
277 if (cmp_ret == 0 &&
STREQ(fsm_iter->
path + path_len, has_trailing_slash ?
"" :
SEP_STR)) {
279 if (fsm_iter != fsm_head) {
281 fsm_iter->
next = fsm_head;
322 for (; tfsm; tfsm = tfsm->
next) {
325 if (tfsm->
name[0] && (!name || !name[0])) {
337 if (name && name[0]) {
341 fsm_iter->
name[0] =
'\0';
347 fsm_iter->
valid =
true;
355 fsm_iter->
next = fsm_head;
360 fsm_prev->
next = fsm_iter;
364 fsm_iter->
next = fsm_head;
377 for (fsm_iter = fsm_head; fsm_iter && idx; fsm_prev = fsm_iter, fsm_iter = fsm_iter->
next) {
385 if (fsm_iter->
save && fsm_iter->
path) {
392 fsm_head = fsm_iter->
next;
413 bool has_error =
false;
414 has_error |= (fprintf(fp,
"[Bookmarks]\n") < 0);
416 fsm_iter = fsm_iter->
next)
418 if (fsm_iter->
path && fsm_iter->
save) {
421 has_error |= (fprintf(fp,
"!%s\n", fsm_iter->
name) < 0);
423 has_error |= (fprintf(fp,
"%s\n", fsm_iter->
path) < 0);
426 has_error = (fprintf(fp,
"[Recent]\n") < 0);
429 fsm_iter = fsm_iter->
next, nwritten++)
431 if (fsm_iter->
path && fsm_iter->
save) {
434 has_error |= (fprintf(fp,
"!%s\n", fsm_iter->
name) < 0);
436 has_error |= (fprintf(fp,
"%s\n", fsm_iter->
path) < 0);
458 while (fgets(line,
sizeof(line), fp) !=
nullptr) {
465 else if (line[0] ==
'!') {
466 int len = strlen(line);
468 if (line[
len - 1] ==
'\n') {
469 line[
len - 1] =
'\0';
475 int len = strlen(line);
477 if (line[
len - 1] ==
'\n') {
478 line[
len - 1] =
'\0';
504 if (fsm_iter->
path) {
527 if (*fsmenu !=
nullptr) {
548 FSMenuEntry *fsm_dst_prev =
nullptr, *fsm_dst_head =
nullptr;
551 for (; fsm_src_iter !=
nullptr; fsm_src_iter = fsm_src_iter->
next) {
553 if (fsm_dst->
path !=
nullptr) {
557 if (fsm_dst_prev !=
nullptr) {
558 fsm_dst_prev->
next = fsm_dst;
561 fsm_dst_head = fsm_dst;
563 fsm_dst_prev = fsm_dst;
587 for (
i = 0; fsm_iter; fsm_iter = fsm_iter->
next,
i++) {
610 for (; fsm_iter; fsm_iter = fsm_iter->
next) {
611 if (worker_status->stop) {
617 worker_status->do_update =
true;
633 for (; fsm_iter_dst !=
nullptr; fsm_iter_dst = fsm_iter_dst->
next) {
634 while (fsm_iter_src !=
nullptr && !
STREQ(fsm_iter_dst->
path, fsm_iter_src->
path)) {
635 fsm_iter_src = fsm_iter_src->
next;
637 if (fsm_iter_src ==
nullptr) {
666 "Validating Bookmarks...",
#define BLENDER_BOOKMARK_FILE
std::optional< std::string > BKE_appdir_folder_id_create(int folder_id, const char *subfolder) ATTR_WARN_UNUSED_RESULT
File and directory operations.
int BLI_exists(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
#define BLI_path_join(...)
bool BLI_path_is_rel(const char *path) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
bool BLI_path_name_at_index(const char *__restrict path, int index, int *__restrict r_offset, int *__restrict r_len) ATTR_NONNULL(1
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
char * STRNCPY(char(&dst)[N], const char *src)
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
#define BLI_string_joinN(...)
#define UNUSED_VARS_NDEBUG(...)
#define STRCASEEQLEN(a, b, n)
@ FS_CATEGORY_SYSTEM_BOOKMARKS
Read Guarded memory(de)allocation.
@ WM_JOB_TYPE_FSMENU_BOOKMARK_VALIDATE
#define ND_SPACE_FILE_LIST
void * MEM_mallocN(size_t len, const char *str)
void * MEM_callocN(size_t len, const char *str)
void * MEM_dupallocN(const void *vmemh)
void MEM_freeN(void *vmemh)
struct wmWindow * winactive
void WM_jobs_timer(wmJob *wm_job, double time_step, uint note, uint endnote)
void WM_jobs_start(wmWindowManager *wm, wmJob *wm_job)
void WM_jobs_kill_type(wmWindowManager *wm, const void *owner, int job_type)
wmJob * WM_jobs_get(wmWindowManager *wm, wmWindow *win, const void *owner, const char *name, const eWM_JobFlag flag, const eWM_JobType job_type)
void WM_jobs_callbacks(wmJob *wm_job, wm_jobs_start_callback startjob, void(*initjob)(void *), void(*update)(void *), void(*endjob)(void *))
void WM_jobs_customdata_set(wmJob *wm_job, void *customdata, void(*free)(void *customdata))