Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/intern/appdir.c
| Context not available. | |||||
| const char *BKE_appdir_folder_default(void) | const char *BKE_appdir_folder_default(void) | ||||
| { | { | ||||
| #ifndef WIN32 | #ifndef WIN32 | ||||
| const char *const xdg_documents_dir = BLI_getenv("XDG_DOCUMENTS_DIR"); | static char documentfolder[FILE_MAX]; | ||||
| if (xdg_documents_dir) { | const char * env_dir_default = BLI_getenv("XDG_DOCUMENTS_DIR"); | ||||
| return xdg_documents_dir; | if (env_dir_default) { | ||||
brecht: You can't edit a `const char *` pointer like this.
This can be solved by doing the same as the… | |||||
Done Inline ActionsResolved this along with other bugs in the Linux changes. nicholas_rishel: Resolved this along with other bugs in the Linux changes. | |||||
| BLI_strncpy(documentfolder, env_dir_default, sizeof(documentfolder)); | |||||
| BLI_add_slash(documentfolder); | |||||
| return documentfolder; | |||||
| } | } | ||||
| return BLI_getenv("HOME"); | env_dir_default = BLI_getenv("HOME"); | ||||
| if (env_dir_default) { | |||||
| BLI_strncpy(documentfolder, env_dir_default, sizeof(documentfolder)); | |||||
| BLI_add_slash(documentfolder); | |||||
| return documentfolder; | |||||
| } | |||||
| return NULL; | |||||
| #else /* Windows */ | #else /* Windows */ | ||||
| static char documentfolder[MAXPATHLEN]; | static char documentfolder[MAXPATHLEN]; | ||||
| HRESULT hResult; | HRESULT hResult; | ||||
| Context not available. | |||||
| /* Check for %HOME% env var */ | /* Check for %HOME% env var */ | ||||
| if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) { | if (uput_getenv("HOME", documentfolder, MAXPATHLEN)) { | ||||
| if (BLI_is_dir(documentfolder)) { | if (BLI_is_dir(documentfolder)) { | ||||
| BLI_add_slash(documentfolder); | |||||
| return documentfolder; | return documentfolder; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
| if (hResult == S_OK) { | if (hResult == S_OK) { | ||||
| if (BLI_is_dir(documentfolder)) { | if (BLI_is_dir(documentfolder)) { | ||||
| BLI_add_slash(documentfolder); | |||||
| return documentfolder; | return documentfolder; | ||||
| } | } | ||||
| } | } | ||||
| Context not available. | |||||
You can't edit a const char * pointer like this.
This can be solved by doing the same as the Windows case, copying to a static char documentfolder[MAXPATHLEN]; and modifying that.