46 static string system_path = string(
static_path) +
"/blender/" + versionstr;
47 return system_path.c_str();
55 static string user_path =
"";
56 static int last_version = 0;
61 if (user_path.empty() || last_version != version) {
62 const char *home = getenv(
"HOME");
64 last_version = version;
67 user_path = string(home) +
"/.blender/" + versionstr;
73 return user_path.c_str();
75 if (user_path.empty() || last_version != version) {
76 const char *home = getenv(
"XDG_CONFIG_HOME");
78 last_version = version;
81 user_path = string(home) +
"/blender/" + versionstr;
84 home = getenv(
"HOME");
85 if (home ==
nullptr) {
86 home = getpwuid(getuid())->pw_dir;
88 user_path = string(home) +
"/.config/blender/" + versionstr;
92 return user_path.c_str();
98 std::string add_path =
"";
102 type_str =
"DESKTOP";
105 type_str =
"DOCUMENTS";
108 type_str =
"DOWNLOAD";
114 type_str =
"PICTURES";
120 const char *cache_dir = getenv(
"XDG_CACHE_HOME");
134 "GHOST_SystemPathsUnix::getUserSpecialDir(): Invalid enum value for type parameter");
138 static string path =
"";
140 string command = string(
"xdg-user-dir ") + type_str +
" 2> /dev/null";
142 FILE *fstream = popen(command.c_str(),
"r");
143 if (fstream ==
nullptr) {
146 std::stringstream path_stream;
147 while (!feof(fstream)) {
148 char c = fgetc(fstream);
155 if (pclose(fstream) == -1) {
156 perror(
"GHOST_SystemPathsUnix::getUserSpecialDir failed at pclose()");
160 if (!add_path.empty()) {
161 path_stream <<
'/' << add_path;
164 path = path_stream.str();
165 return path[0] ? path.c_str() :
nullptr;
#define GHOST_ASSERT(x, info)
static const char * static_path
GHOST_TUserSpecialDirTypes
@ GHOST_kUserSpecialDirDesktop
@ GHOST_kUserSpecialDirMusic
@ GHOST_kUserSpecialDirPictures
@ GHOST_kUserSpecialDirVideos
@ GHOST_kUserSpecialDirDownloads
@ GHOST_kUserSpecialDirCaches
@ GHOST_kUserSpecialDirDocuments
_GL_VOID GLfloat value _GL_VOID_RET _GL_VOID const GLuint GLboolean *residences _GL_BOOL_RET _GL_VOID GLsizei GLfloat GLfloat GLfloat GLfloat const GLubyte *bitmap _GL_VOID_RET _GL_VOID GLenum type
const char * getBinaryDir() const
const char * getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
void addToSystemRecentFiles(const char *filename) const
const char * getSystemDir(int version, const char *versionstr) const
const char * getUserDir(int version, const char *versionstr) const