65 static string system_path = string(
static_path) +
"/blender/" + versionstr;
74 static string user_path =
"";
75 static int last_version = 0;
80 if (user_path.empty() || last_version != version) {
81 const char *home = getenv(
"HOME");
83 last_version = version;
86 user_path = string(home) +
"/.blender/" + versionstr;
95 if (user_path.empty() || last_version != version) {
96 const char *home = getenv(
"XDG_CONFIG_HOME");
98 last_version = version;
101 user_path = string(home) +
"/blender/" + versionstr;
104 home = getenv(
"HOME");
107 home = getpwuid(getuid())->pw_dir;
109 user_path = string(home) +
"/.config/blender/" + versionstr;
119 const char *type_str;
123 type_str =
"DESKTOP";
126 type_str =
"DOCUMENTS";
129 type_str =
"DOWNLOAD";
135 type_str =
"PICTURES";
143 "GHOST_SystemPathsUnix::getUserSpecialDir(): Invalid enum value for type parameter");
147 static string path =
"";
149 string command = string(
"xdg-user-dir ") + type_str +
" 2> /dev/null";
151 FILE *fstream = popen(command.c_str(),
"r");
152 if (fstream ==
NULL) {
155 std::stringstream path_stream;
156 while (!feof(fstream)) {
157 char c = fgetc(fstream);
164 if (pclose(fstream) == -1) {
165 perror(
"GHOST_SystemPathsUnix::getUserSpecialDir failed at pclose()");
169 path = path_stream.str();
#define GHOST_ASSERT(x, info)
static const char * static_path
GHOST_TUserSpecialDirTypes
@ GHOST_kUserSpecialDirDesktop
@ GHOST_kUserSpecialDirMusic
@ GHOST_kUserSpecialDirPictures
@ GHOST_kUserSpecialDirVideos
@ GHOST_kUserSpecialDirDownloads
@ GHOST_kUserSpecialDirDocuments
unsigned char GHOST_TUns8
_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 GHOST_TUns8 * getUserSpecialDir(GHOST_TUserSpecialDirTypes type) const
const GHOST_TUns8 * getBinaryDir() const
const GHOST_TUns8 * getUserDir(int version, const char *versionstr) const
void addToSystemRecentFiles(const char *filename) const
const GHOST_TUns8 * getSystemDir(int version, const char *versionstr) const