Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Eisel <julian@blender.org>2020-12-16 22:28:15 +0300
committerJulian Eisel <julian@blender.org>2020-12-16 22:36:37 +0300
commit9d152263837f0ac5e790e0b12d3b3cfed31bed0f (patch)
tree4914ccf58b3599f5469c524d1bf93299fa08249c
parenta8da70f70a1f581412982d1f858b7b9a96ab8c37 (diff)
Ghost/Linux: Avoid error print if special directory can't be determined
The function is supposed to fail gracefully if there is some error. That includes not being able to find `xdg-user-dir`. So don't let the error be printed to the console, it's misleading/annoying. From what I can tell we'll detect that problem fine and return NULL then.
-rw-r--r--intern/ghost/intern/GHOST_SystemPathsUnix.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
index fdfde13b915..86f3a0a31fb 100644
--- a/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
+++ b/intern/ghost/intern/GHOST_SystemPathsUnix.cpp
@@ -142,7 +142,8 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDi
}
static string path = "";
- string command = string("xdg-user-dir ") + type_str;
+ /* Pipe stderr to /dev/null to avoid error prints. We will fail gracefully still. */
+ string command = string("xdg-user-dir ") + type_str + " 2> /dev/null";
FILE *fstream = popen(command.c_str(), "r");
if (fstream == NULL) {
@@ -163,7 +164,7 @@ const GHOST_TUns8 *GHOST_SystemPathsUnix::getUserSpecialDir(GHOST_TUserSpecialDi
}
path = path_stream.str();
- return (const GHOST_TUns8 *)path.c_str();
+ return path[0] ? (const GHOST_TUns8 *)path.c_str() : NULL;
}
const GHOST_TUns8 *GHOST_SystemPathsUnix::getBinaryDir() const