Blender V4.3
fsmenu_system.cc
Go to the documentation of this file.
1/* SPDX-FileCopyrightText: 2001-2002 NaN Holding BV. All rights reserved.
2 *
3 * SPDX-License-Identifier: GPL-2.0-or-later */
4
9#include <cmath>
10#include <cstdio>
11#include <cstdlib>
12#include <cstring>
13
14#include "MEM_guardedalloc.h"
15
16#include "BLI_fileops.h"
17#include "BLI_ghash.h"
18#include "BLI_listbase.h"
19#include "BLI_path_utils.hh"
20#include "BLI_string.h"
21#include "BLI_utildefines.h"
22
23#include "DNA_userdef_types.h"
24
25#include "BLT_translation.hh"
26
27#include "ED_fileselect.hh"
28
29#ifdef WIN32
30# include "BLI_string_utf8.h" /* For `BLI_strncpy_wchar_as_utf8`. */
31
32/* Need to include windows.h so _WIN32_IE is defined. */
33# include <windows.h>
34/* For SHGetSpecialFolderPath, has to be done before BLI_winstuff
35 * because 'near' is disabled through BLI_windstuff. */
36# include "BLI_winstuff.h"
37# include <comdef.h>
38# include <comutil.h>
39# include <shlobj.h>
40# include <shlwapi.h>
41# include <wrl.h>
42#endif
43
44#include "UI_resources.hh"
45
46#ifdef __APPLE__
47# include <Carbon/Carbon.h>
48#endif /* __APPLE__ */
49
50#ifdef __linux__
51# include "BLI_fileops_types.h"
52# include <mntent.h>
53#endif
54
55#include "fsmenu.h"
56
57struct FSMenu;
58
59/* -------------------------------------------------------------------- */
69static GHash *fsmenu_xdg_user_dirs_parse(const char *home)
70{
71 /* Add to the default for variable, equals & quotes. */
72 char l[128 + FILE_MAXDIR];
73 FILE *fp;
74
75 /* Check if the config file exists. */
76 {
77 char filepath[FILE_MAX];
78 const char *xdg_config_home = getenv("XDG_CONFIG_HOME");
79 if (xdg_config_home != nullptr) {
80 BLI_path_join(filepath, sizeof(filepath), xdg_config_home, "user-dirs.dirs");
81 }
82 else {
83 BLI_path_join(filepath, sizeof(filepath), home, ".config", "user-dirs.dirs");
84 }
85 fp = BLI_fopen(filepath, "r");
86 if (!fp) {
87 return nullptr;
88 }
89 }
90 /* By default there are 8 paths. */
91 GHash *xdg_map = BLI_ghash_str_new_ex(__func__, 8);
92 while (fgets(l, sizeof(l), fp) != nullptr) { /* read a line */
93
94 /* Avoid inserting invalid values. */
95 if (STRPREFIX(l, "XDG_")) {
96 char *l_value = strchr(l, '=');
97 if (l_value != nullptr) {
98 *l_value = '\0';
99 l_value++;
100
101 BLI_str_rstrip(l_value);
102 const uint l_value_len = strlen(l_value);
103 if ((l_value[0] == '"') && (l_value_len > 0) && (l_value[l_value_len - 1] == '"')) {
104 l_value[l_value_len - 1] = '\0';
105 l_value++;
106
107 char l_value_expanded[FILE_MAX];
108 char *l_value_final = l_value;
109
110 /* This is currently the only variable used.
111 * Based on the 'user-dirs.dirs' man page,
112 * there is no need to resolve arbitrary environment variables. */
113 if (STRPREFIX(l_value, "$HOME" SEP_STR)) {
114 BLI_path_join(l_value_expanded, sizeof(l_value_expanded), home, l_value + 6);
115 l_value_final = l_value_expanded;
116 }
117
118 BLI_ghash_insert(xdg_map, BLI_strdup(l), BLI_strdup(l_value_final));
119 }
120 }
121 }
122 }
123 fclose(fp);
124
125 return xdg_map;
126}
127
128static void fsmenu_xdg_user_dirs_free(GHash *xdg_map)
129{
130 if (xdg_map != nullptr) {
132 }
133}
134
143static void fsmenu_xdg_insert_entry(GHash *xdg_map,
144 FSMenu *fsmenu,
145 const char *key,
146 const char *default_path,
147 int icon,
148 const char *home)
149{
150 char xdg_path_buf[FILE_MAXDIR];
151 const char *xdg_path = (const char *)(xdg_map ? BLI_ghash_lookup(xdg_map, key) : nullptr);
152 if (xdg_path == nullptr) {
153 BLI_path_join(xdg_path_buf, sizeof(xdg_path_buf), home, default_path);
154 xdg_path = xdg_path_buf;
155 }
157 fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, xdg_path, N_(default_path), icon, FS_INSERT_LAST);
158}
159
162#ifdef WIN32
163/* Add Windows Quick Access items to the System list. */
164static void fsmenu_add_windows_quick_access(FSMenu *fsmenu,
165 FSMenuCategory category,
167{
168 Microsoft::WRL::ComPtr<IShellDispatch> shell;
169 if (CoCreateInstance(CLSID_Shell, nullptr, CLSCTX_ALL, IID_PPV_ARGS(shell.GetAddressOf())) !=
170 S_OK)
171 {
172 return;
173 }
174
175 /* Open Quick Access folder. */
176 Microsoft::WRL::ComPtr<Folder> dir;
177 if (shell->NameSpace(_variant_t(L"shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}"),
178 dir.GetAddressOf()) != S_OK)
179 {
180 return;
181 }
182
183 /* Get FolderItems. */
184 Microsoft::WRL::ComPtr<FolderItems> items;
185 if (dir->Items(items.GetAddressOf()) != S_OK) {
186 return;
187 }
188
189 long count = 0;
190 if (items->get_Count(&count) != S_OK) {
191 return;
192 }
193
194 /* Iterate through the folder. */
195 for (long i = 0; i < count; i++) {
196 Microsoft::WRL::ComPtr<FolderItem> item;
197
198 if (items->Item(_variant_t(i), item.GetAddressOf()) != S_OK) {
199 continue;
200 }
201
202 VARIANT_BOOL isFolder;
203 /* Skip if it's not a folder. */
204 if (item->get_IsFolder(&isFolder) != S_OK || isFolder == VARIANT_FALSE) {
205 continue;
206 }
207
208 _bstr_t path;
209 if (item->get_Path(path.GetAddress()) != S_OK) {
210 continue;
211 }
212
213 char utf_path[FILE_MAXDIR];
214 BLI_strncpy_wchar_as_utf8(utf_path, path, FILE_MAXDIR);
215
216 /* Skip library folders since they are not currently supported. */
217 if (!BLI_strcasestr(utf_path, ".library-ms")) {
218 /* Add folder to the fsmenu. */
219 fsmenu_insert_entry(fsmenu, category, utf_path, NULL, ICON_FILE_FOLDER, flag);
220 }
221 }
222}
223
224/* Add a Windows known folder path to the System list. */
225static void fsmenu_add_windows_folder(FSMenu *fsmenu,
226 FSMenuCategory category,
227 REFKNOWNFOLDERID rfid,
228 const char *name,
229 const int icon,
231{
232 LPWSTR pPath;
233 char line[FILE_MAXDIR];
234 if (SHGetKnownFolderPath(rfid, 0, nullptr, &pPath) == S_OK) {
236 fsmenu_insert_entry(fsmenu, category, line, name, icon, flag);
237 }
238 CoTaskMemFree(pPath);
239}
240#endif
241
242void fsmenu_read_system(FSMenu *fsmenu, int read_bookmarks)
243{
244 char line[FILE_MAXDIR];
245#ifdef WIN32
246 /* Add the drive names to the listing */
247 {
248 wchar_t wline[FILE_MAXDIR];
249 __int64 tmp;
250 char tmps[4], *name;
251
252 tmp = GetLogicalDrives();
253
254 for (int i = 0; i < 26; i++) {
255 if ((tmp >> i) & 1) {
256 tmps[0] = 'A' + i;
257 tmps[1] = ':';
258 tmps[2] = '\\';
259 tmps[3] = '\0';
260 name = nullptr;
261
262 /* Skip over floppy disks A & B. */
263 if (i > 1) {
264 /* Friendly volume descriptions without using SHGetFileInfoW (#85689). */
265 BLI_strncpy_wchar_from_utf8(wline, tmps, 4);
266 IShellFolder *desktop;
267 if (SHGetDesktopFolder(&desktop) == S_OK) {
268 PIDLIST_RELATIVE volume;
269 if (desktop->ParseDisplayName(nullptr, nullptr, wline, nullptr, &volume, nullptr) ==
270 S_OK)
271 {
272 STRRET volume_name;
273 volume_name.uType = STRRET_WSTR;
274 if (desktop->GetDisplayNameOf(volume, SHGDN_FORADDRESSBAR, &volume_name) == S_OK) {
275 wchar_t *volume_name_wchar;
276 if (StrRetToStrW(&volume_name, volume, &volume_name_wchar) == S_OK) {
277 BLI_strncpy_wchar_as_utf8(line, volume_name_wchar, FILE_MAXDIR);
278 name = line;
279 CoTaskMemFree(volume_name_wchar);
280 }
281 }
282 CoTaskMemFree(volume);
283 }
284 desktop->Release();
285 }
286 }
287 if (name == nullptr) {
288 name = tmps;
289 }
290
291 int icon = ICON_DISK_DRIVE;
292 switch (GetDriveType(tmps)) {
293 case DRIVE_REMOVABLE:
294 icon = ICON_EXTERNAL_DRIVE;
295 break;
296 case DRIVE_CDROM:
297 icon = ICON_DISC;
298 break;
299 case DRIVE_FIXED:
300 case DRIVE_RAMDISK:
301 icon = ICON_DISK_DRIVE;
302 break;
303 case DRIVE_REMOTE:
304 icon = ICON_NETWORK_DRIVE;
305 break;
306 }
307
308 fsmenu_insert_entry(fsmenu,
310 tmps,
311 name,
312 icon,
314 }
315 }
316
317 /* Get Special Folder Locations. */
318 if (read_bookmarks) {
319
320 /* These items are shown in System List. */
321 fsmenu_add_windows_folder(fsmenu,
323 FOLDERID_Profile,
324 N_("Home"),
325 ICON_HOME,
327 fsmenu_add_windows_folder(fsmenu,
329 FOLDERID_Desktop,
330 N_("Desktop"),
331 ICON_DESKTOP,
333 fsmenu_add_windows_folder(fsmenu,
335 FOLDERID_Documents,
336 N_("Documents"),
337 ICON_DOCUMENTS,
339 fsmenu_add_windows_folder(fsmenu,
341 FOLDERID_Downloads,
342 N_("Downloads"),
343 ICON_IMPORT,
345 fsmenu_add_windows_folder(fsmenu,
347 FOLDERID_Music,
348 N_("Music"),
349 ICON_FILE_SOUND,
351 fsmenu_add_windows_folder(fsmenu,
353 FOLDERID_Pictures,
354 N_("Pictures"),
355 ICON_FILE_IMAGE,
357 fsmenu_add_windows_folder(fsmenu,
359 FOLDERID_Videos,
360 N_("Videos"),
361 ICON_FILE_MOVIE,
363 fsmenu_add_windows_folder(fsmenu,
365 FOLDERID_Fonts,
366 N_("Fonts"),
367 ICON_FILE_FONT,
369 fsmenu_add_windows_folder(fsmenu,
371 FOLDERID_SkyDrive,
372 N_("OneDrive"),
373 ICON_INTERNET,
375
376 /* These items are just put in path cache for thumbnail views and if bookmarked. */
377 fsmenu_add_windows_folder(fsmenu,
379 FOLDERID_UserProfiles,
380 nullptr,
381 ICON_COMMUNITY,
383
384 /* Last add Quick Access items to avoid duplicates and use icons if available. */
385 fsmenu_add_windows_quick_access(fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, FS_INSERT_LAST);
386 }
387 }
388#elif defined(__APPLE__)
389 {
390 /* We store some known macOS system paths and corresponding icons
391 * and names in the FS_CATEGORY_OTHER (not displayed directly) category. */
393 fsmenu, FS_CATEGORY_OTHER, "/Library/Fonts/", N_("Fonts"), ICON_FILE_FONT, FS_INSERT_LAST);
394 fsmenu_insert_entry(fsmenu,
396 "/Applications/",
397 N_("Applications"),
398 ICON_FILE_FOLDER,
400
401 const char *home = BLI_getenv("HOME");
402 if (home) {
403# define FS_MACOS_PATH(path, name, icon) \
404\
405 SNPRINTF(line, path, home); \
406\
407 fsmenu_insert_entry(fsmenu, FS_CATEGORY_OTHER, line, name, icon, FS_INSERT_LAST);
408
409 FS_MACOS_PATH("%s/", nullptr, ICON_HOME)
410 FS_MACOS_PATH("%s/Desktop/", N_("Desktop"), ICON_DESKTOP)
411 FS_MACOS_PATH("%s/Documents/", N_("Documents"), ICON_DOCUMENTS)
412 FS_MACOS_PATH("%s/Downloads/", N_("Downloads"), ICON_IMPORT)
413 FS_MACOS_PATH("%s/Movies/", N_("Movies"), ICON_FILE_MOVIE)
414 FS_MACOS_PATH("%s/Music/", N_("Music"), ICON_FILE_SOUND)
415 FS_MACOS_PATH("%s/Pictures/", N_("Pictures"), ICON_FILE_IMAGE)
416 FS_MACOS_PATH("%s/Library/Fonts/", N_("Fonts"), ICON_FILE_FONT)
417
418# undef FS_MACOS_PATH
419 }
420
421 /* Get mounted volumes better method OSX 10.6 and higher, see:
422 * https://developer.apple.com/library/mac/#documentation/CoreFoundation/Reference/CFURLRef/Reference/reference.html
423 */
424
425 /* We get all volumes sorted including network and do not relay
426 * on user-defined finder visibility, less confusing. */
427
428 CFURLRef cfURL = nullptr;
429 CFURLEnumeratorResult result = kCFURLEnumeratorSuccess;
430 CFURLEnumeratorRef volEnum = CFURLEnumeratorCreateForMountedVolumes(
431 nullptr, kCFURLEnumeratorSkipInvisibles, nullptr);
432
433 while (result != kCFURLEnumeratorEnd) {
434 char defPath[FILE_MAX];
435
436 result = CFURLEnumeratorGetNextURL(volEnum, &cfURL, nullptr);
437 if (result != kCFURLEnumeratorSuccess) {
438 continue;
439 }
440
441 CFURLGetFileSystemRepresentation(cfURL, false, (UInt8 *)defPath, FILE_MAX);
442
443 /* Get name of the volume. */
444 char display_name[FILE_MAXFILE] = "";
445 CFStringRef nameString = nullptr;
446 CFURLCopyResourcePropertyForKey(cfURL, kCFURLVolumeLocalizedNameKey, &nameString, nullptr);
447 if (nameString != nullptr) {
448 CFStringGetCString(nameString, display_name, sizeof(display_name), kCFStringEncodingUTF8);
449 CFRelease(nameString);
450 }
451
452 /* Set icon for regular, removable or network drive. */
453 int icon = ICON_DISK_DRIVE;
454 CFBooleanRef localKey = nullptr;
455 CFURLCopyResourcePropertyForKey(cfURL, kCFURLVolumeIsLocalKey, &localKey, nullptr);
456 if (localKey != nullptr) {
457 if (!CFBooleanGetValue(localKey)) {
458 icon = ICON_NETWORK_DRIVE;
459 }
460 else {
461 CFBooleanRef ejectableKey = nullptr;
462 CFURLCopyResourcePropertyForKey(
463 cfURL, kCFURLVolumeIsEjectableKey, &ejectableKey, nullptr);
464 if (ejectableKey != nullptr) {
465 if (CFBooleanGetValue(ejectableKey)) {
466 icon = ICON_EXTERNAL_DRIVE;
467 }
468 CFRelease(ejectableKey);
469 }
470 }
471 CFRelease(localKey);
472 }
473
474 fsmenu_insert_entry(fsmenu,
476 defPath,
477 display_name[0] ? display_name : nullptr,
478 icon,
480 }
481
482 CFRelease(volEnum);
483
484/* kLSSharedFileListFavoriteItems is deprecated, but available till macOS 10.15.
485 * Will have to find a new method to sync the Finder Favorites with File Browser. */
486# pragma GCC diagnostic push
487# pragma GCC diagnostic ignored "-Wdeprecated-declarations"
488 /* Finally get user favorite places */
489 if (read_bookmarks) {
490 UInt32 seed;
491 LSSharedFileListRef list = LSSharedFileListCreate(
492 nullptr, kLSSharedFileListFavoriteItems, nullptr);
493 CFArrayRef pathesArray = LSSharedFileListCopySnapshot(list, &seed);
494 CFIndex pathesCount = CFArrayGetCount(pathesArray);
495
496 for (CFIndex i = 0; i < pathesCount; i++) {
497 LSSharedFileListItemRef itemRef = (LSSharedFileListItemRef)CFArrayGetValueAtIndex(
498 pathesArray, i);
499
500 CFURLRef cfURL = nullptr;
501 OSErr err = LSSharedFileListItemResolve(itemRef,
502 kLSSharedFileListNoUserInteraction |
503 kLSSharedFileListDoNotMountVolumes,
504 &cfURL,
505 nullptr);
506 if (err != noErr || !cfURL) {
507 continue;
508 }
509
510 CFStringRef pathString = CFURLCopyFileSystemPath(cfURL, kCFURLPOSIXPathStyle);
511
512 if (pathString == nullptr ||
513 !CFStringGetCString(pathString, line, sizeof(line), kCFStringEncodingUTF8))
514 {
515 continue;
516 }
517
518 /* Exclude "all my files" as it makes no sense in blender file-selector. */
519 /* Exclude "airdrop" if WLAN not active as it would show "". */
520 if (!strstr(line, "myDocuments.cannedSearch") && (*line != '\0')) {
521 fsmenu_insert_entry(fsmenu,
523 line,
524 nullptr,
525 ICON_FILE_FOLDER,
527 }
528
529 CFRelease(pathString);
530 CFRelease(cfURL);
531 }
532
533 CFRelease(pathesArray);
534 CFRelease(list);
535 }
536# pragma GCC diagnostic pop
537 }
538#else
539 /* unix */
540 {
541 const char *home = BLI_getenv("HOME");
542
543 if (read_bookmarks && home) {
544
546 fsmenu, FS_CATEGORY_SYSTEM_BOOKMARKS, home, N_("Home"), ICON_HOME, FS_INSERT_LAST);
547
548 /* Follow the XDG spec, check if these are available. */
549 GHash *xdg_map = fsmenu_xdg_user_dirs_parse(home);
550
551 struct {
552 const char *key;
553 const char *default_path;
554 BIFIconID icon;
555 } xdg_items[] = {
556 {"XDG_DESKTOP_DIR", "Desktop", ICON_DESKTOP},
557 {"XDG_DOCUMENTS_DIR", "Documents", ICON_DOCUMENTS},
558 {"XDG_DOWNLOAD_DIR", "Downloads", ICON_IMPORT},
559 {"XDG_VIDEOS_DIR", "Videos", ICON_FILE_MOVIE},
560 {"XDG_PICTURES_DIR", "Pictures", ICON_FILE_IMAGE},
561 {"XDG_MUSIC_DIR", "Music", ICON_FILE_SOUND},
562 };
563
564 for (int i = 0; i < ARRAY_SIZE(xdg_items); i++) {
566 xdg_map, fsmenu, xdg_items[i].key, xdg_items[i].default_path, xdg_items[i].icon, home);
567 }
568
570 }
571
572 {
573 int found = 0;
574# ifdef __linux__
575 /* loop over mount points */
576 mntent *mnt;
577 FILE *fp;
578
579 fp = setmntent(MOUNTED, "r");
580 if (fp == nullptr) {
581 fprintf(stderr, "could not get a list of mounted file-systems\n");
582 }
583 else {
584 while ((mnt = getmntent(fp))) {
585 if (STRPREFIX(mnt->mnt_dir, "/boot")) {
586 /* Hide share not usable to the user. */
587 continue;
588 }
589 if (!STRPREFIX(mnt->mnt_fsname, "/dev")) {
590 continue;
591 }
592 if (STRPREFIX(mnt->mnt_fsname, "/dev/loop")) {
593 /* The dev/loop* entries are SNAPS used by desktop environment
594 * (Gnome) no need for them to show up in the list. */
595 continue;
596 }
597
598 fsmenu_insert_entry(fsmenu,
600 mnt->mnt_dir,
601 nullptr,
602 ICON_DISK_DRIVE,
604
605 found = 1;
606 }
607 if (endmntent(fp) == 0) {
608 fprintf(stderr, "could not close the list of mounted file-systems\n");
609 }
610 }
611 /* Check `gvfs` shares. */
612 const char *const xdg_runtime_dir = BLI_getenv("XDG_RUNTIME_DIR");
613 if (xdg_runtime_dir != nullptr) {
614 direntry *dirs;
615 char filepath[FILE_MAX];
616 BLI_path_join(filepath, sizeof(filepath), xdg_runtime_dir, "gvfs/");
617 /* Avoid error message if the directory doesn't exist as this isn't a requirement. */
618 if (BLI_is_dir(filepath)) {
619 const uint dirs_num = BLI_filelist_dir_contents(filepath, &dirs);
620 for (uint i = 0; i < dirs_num; i++) {
621 if ((dirs[i].type & S_IFDIR) == 0) {
622 continue;
623 }
624 const char *dirname = dirs[i].relname;
625 if (dirname[0] == '.') {
626 continue;
627 }
628
629 /* Directory names contain a lot of unwanted text.
630 * Assuming every entry ends with the share name. */
631 const char *label = strstr(dirname, "share=");
632 if (label != nullptr) {
633 /* Move pointer so `share=` is trimmed off or use full `dirname` as label. */
634 const char *label_test = label + 6;
635 label = *label_test ? label_test : dirname;
636 }
637 SNPRINTF(line, "%s%s", filepath, dirname);
639 fsmenu, FS_CATEGORY_SYSTEM, line, label, ICON_NETWORK_DRIVE, FS_INSERT_SORTED);
640 found = 1;
641 }
642 BLI_filelist_free(dirs, dirs_num);
643 }
644 }
645# endif
646
647 /* fallback */
648 if (!found) {
650 fsmenu, FS_CATEGORY_SYSTEM, "/", nullptr, ICON_DISK_DRIVE, FS_INSERT_SORTED);
651 }
652 }
653 }
654#endif
655
656#if defined(__APPLE__)
657 /* Quiet warnings. */
659#endif
660
661/* For all platforms, we add some directories from User Preferences to
662 * the FS_CATEGORY_OTHER category so that these directories
663 * have the appropriate icons when they are added to the Bookmarks. */
664#define FS_UDIR_PATH(dir, icon) \
665\
666 if (BLI_strnlen(dir, 3) > 2) { \
667\
668 fsmenu_insert_entry(fsmenu, FS_CATEGORY_OTHER, dir, nullptr, icon, FS_INSERT_LAST); \
669 }
670
671 FS_UDIR_PATH(U.fontdir, ICON_FILE_FONT)
672 FS_UDIR_PATH(U.textudir, ICON_FILE_IMAGE)
673 LISTBASE_FOREACH (bUserScriptDirectory *, script_dir, &U.script_directories) {
674 if (UNLIKELY(script_dir->dir_path[0] == '\0')) {
675 continue;
676 }
677 fsmenu_insert_entry(fsmenu,
679 script_dir->dir_path,
680 script_dir->name,
681 ICON_FILE_SCRIPT,
683 }
684 FS_UDIR_PATH(U.sounddir, ICON_FILE_SOUND)
685 FS_UDIR_PATH(U.tempdir, ICON_TEMP)
686
687#undef FS_UDIR_PATH
688}
File and directory operations.
FILE * BLI_fopen(const char *filepath, const char *mode) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
unsigned int BLI_filelist_dir_contents(const char *dirname, struct direntry **r_filelist)
bool BLI_is_dir(const char *path) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL()
Definition storage.cc:433
void BLI_filelist_free(struct direntry *filelist, unsigned int nrentries)
Some types for dealing with directories.
GHash * BLI_ghash_str_new_ex(const char *info, unsigned int nentries_reserve) ATTR_MALLOC ATTR_WARN_UNUSED_RESULT
void * BLI_ghash_lookup(const GHash *gh, const void *key) ATTR_WARN_UNUSED_RESULT
Definition BLI_ghash.c:731
void BLI_ghash_insert(GHash *gh, void *key, void *val)
Definition BLI_ghash.c:707
void BLI_ghash_free(GHash *gh, GHashKeyFreeFP keyfreefp, GHashValFreeFP valfreefp)
Definition BLI_ghash.c:860
#define LISTBASE_FOREACH(type, var, list)
#define FILE_MAXFILE
#define FILE_MAX
#define BLI_path_join(...)
const char * BLI_getenv(const char *env) ATTR_NONNULL(1) ATTR_WARN_UNUSED_RESULT
#define FILE_MAXDIR
char * BLI_strdup(const char *str) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1) ATTR_MALLOC
Definition string.c:40
void BLI_str_rstrip(char *str) ATTR_NONNULL(1)
Definition string.c:976
#define SNPRINTF(dst, format,...)
Definition BLI_string.h:597
int char * BLI_strcasestr(const char *s, const char *find) ATTR_WARN_UNUSED_RESULT ATTR_NONNULL(1
size_t size_t BLI_strncpy_wchar_from_utf8(wchar_t *__restrict dst_w, const char *__restrict src_c, size_t dst_w_maxncpy) ATTR_NONNULL(1
size_t BLI_strncpy_wchar_as_utf8(char *__restrict dst, const wchar_t *__restrict src, size_t dst_maxncpy) ATTR_NONNULL(1
unsigned int uint
#define STRPREFIX(a, b)
#define ARRAY_SIZE(arr)
#define UNUSED_VARS(...)
#define UNLIKELY(x)
Compatibility-like things for windows.
const char * dirname(char *path)
FSMenuCategory
@ FS_CATEGORY_SYSTEM_BOOKMARKS
@ FS_CATEGORY_OTHER
@ FS_CATEGORY_SYSTEM
FSMenuInsert
@ FS_INSERT_NO_VALIDATE
@ FS_INSERT_SORTED
@ FS_INSERT_LAST
Read Guarded memory(de)allocation.
int BIFIconID
ATTR_WARN_UNUSED_RESULT const BMLoop * l
unsigned int U
Definition btGjkEpa3.h:78
static unsigned long seed
Definition btSoftBody.h:39
const char * label
#define NULL
void fsmenu_insert_entry(FSMenu *fsmenu, FSMenuCategory category, const char *path, const char *name, int icon, FSMenuInsert flag)
Definition fsmenu.cc:251
static void fsmenu_xdg_insert_entry(GHash *xdg_map, FSMenu *fsmenu, const char *key, const char *default_path, int icon, const char *home)
void fsmenu_read_system(FSMenu *fsmenu, int read_bookmarks)
static void fsmenu_xdg_user_dirs_free(GHash *xdg_map)
#define FS_UDIR_PATH(dir, icon)
static GHash * fsmenu_xdg_user_dirs_parse(const char *home)
int count
void MEM_freeN(void *vmemh)
Definition mallocn.cc:105
#define L
const char * relname
#define SEP_STR
Definition unit.cc:39
#define N_(msgid)
uint8_t flag
Definition wm_window.cc:138