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