Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/appdir.c
| Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | |||||
| /** | /** | ||||
| * Get the user's home directory, i.e. | * Get the user's home directory, i.e. | ||||
| * - Unix: `$HOME` | * - Unix: `$HOME` | ||||
| * - Windows: `%userprofile%` | * - Windows: `%userprofile%` | ||||
| */ | */ | ||||
| const char *BKE_appdir_folder_home(void) | const char *BKE_appdir_folder_home(void) | ||||
| { | { | ||||
| #ifndef WIN32 | #ifdef WIN32 | ||||
| return BLI_getenv("HOME"); | |||||
| #else /* Windows */ | |||||
| return BLI_getenv("userprofile"); | return BLI_getenv("userprofile"); | ||||
| #elif defined(__APPLE__) | |||||
| return BLI_expand_tilde("~/"); | |||||
| #else | |||||
| return BLI_getenv("HOME"); | |||||
| #endif | #endif | ||||
| } | } | ||||
| /** | /** | ||||
| * Get the user's document directory, i.e. | * Get the user's document directory, i.e. | ||||
| * - Linux: `$HOME/Documents` | * - Linux: `$HOME/Documents` | ||||
| * - Windows: `%userprofile%/Documents` | * - Windows: `%userprofile%/Documents` | ||||
| * | * | ||||
| ▲ Show 20 Lines • Show All 74 Lines • ▼ Show 20 Lines | |||||
| #ifdef WIN32 | #ifdef WIN32 | ||||
| wchar_t wpath[FILE_MAXDIR]; | wchar_t wpath[FILE_MAXDIR]; | ||||
| if (SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0)) { | if (SHGetSpecialFolderPathW(0, wpath, CSIDL_FONTS, 0)) { | ||||
| wcscat(wpath, L"\\"); | wcscat(wpath, L"\\"); | ||||
| BLI_strncpy_wchar_as_utf8(test_dir, wpath, sizeof(test_dir)); | BLI_strncpy_wchar_as_utf8(test_dir, wpath, sizeof(test_dir)); | ||||
| } | } | ||||
| #elif defined(__APPLE__) | #elif defined(__APPLE__) | ||||
| const char *home = BLI_getenv("HOME"); | STRNCPY(test_dir, BLI_expand_tilde("~/Library/Fonts/")); | ||||
| if (home) { | |||||
| BLI_path_join(test_dir, sizeof(test_dir), home, "Library", "Fonts", NULL); | |||||
| } | |||||
| #else | #else | ||||
| STRNCPY(test_dir, "/usr/share/fonts"); | STRNCPY(test_dir, "/usr/share/fonts"); | ||||
| #endif | #endif | ||||
| if (test_dir[0] && BLI_exists(test_dir)) { | if (test_dir[0] && BLI_exists(test_dir)) { | ||||
| BLI_strncpy(dir, test_dir, FILE_MAXDIR); | BLI_strncpy(dir, test_dir, FILE_MAXDIR); | ||||
| return true; | return true; | ||||
| } | } | ||||
| ▲ Show 20 Lines • Show All 958 Lines • Show Last 20 Lines | |||||