1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
From: Pino Toscano <pino@debian.org>
Date: Mon, 3 Feb 2020 08:16:42 +0100
Subject: Fix cdom::getSystemTmpDir(),
and cdom::getRandomFileName() on all the non-Linux systems that use GNU libc
(e.g. kFreeBSD, and Hurd): use the same code of Linux paths.
This patch comes from https://github.com/rdiankov/collada-dom/pull/32
---
dom/src/dae/daeUtils.cpp | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/dom/src/dae/daeUtils.cpp b/dom/src/dae/daeUtils.cpp
index 7e3dc9a..de30ca0 100644
--- a/dom/src/dae/daeUtils.cpp
+++ b/dom/src/dae/daeUtils.cpp
@@ -152,7 +152,7 @@ char cdom::getFileSeparator() {
const string& cdom::getSystemTmpDir() {
#ifdef WIN32
static string tmpDir = string(getenv("TMP")) + getFileSeparator();
-#elif defined(__linux__) || defined(__linux)
+#elif defined(__linux__) || defined(__linux) || defined(__GLIBC__)
static string tmpDir = "/tmp/";
#elif defined __APPLE_CC__
static string tmpDir = string(getenv("TMPDIR"));
@@ -171,7 +171,7 @@ string cdom::getRandomFileName() {
std::string tmp(tmpnam(&tmpbuffer[0]));
#ifdef WIN32
randomSegment = tmp.substr(tmp.find_last_of('\\')+1);
-#elif defined(__linux__) || defined(__linux)
+#elif defined(__linux__) || defined(__linux) || defined(__GLIBC__)
randomSegment = tmp.substr(tmp.find_last_of('/')+1);
#elif defined __APPLE_CC__
randomSegment = tmp.substr(tmp.find_last_of('/')+1);
|