From 6c0a610fb1aaf52348445d6560d1cf5d017661e2 Mon Sep 17 00:00:00 2001 From: wmayer Date: Thu, 9 Jun 2022 15:40:37 +0200 Subject: [PATCH] App: issue #6892: FreeCAD fails to start --- src/App/Application.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/App/Application.cpp b/src/App/Application.cpp index 6d7d6667c2..30816239d5 100644 --- a/src/App/Application.cpp +++ b/src/App/Application.cpp @@ -1127,7 +1127,8 @@ std::string Application::getUserMacroDir() std::string Application::getResourceDir() { #ifdef RESOURCEDIR - std::string path(RESOURCEDIR); + // #6892: Conda may inject null characters => remove them + std::string path = std::string(RESOURCEDIR).c_str(); path.append("/"); QDir dir(QString::fromStdString(path)); if (dir.isAbsolute()) @@ -1141,7 +1142,8 @@ std::string Application::getResourceDir() std::string Application::getLibraryDir() { #ifdef LIBRARYDIR - std::string path(LIBRARYDIR); + // #6892: Conda may inject null characters => remove them + std::string path = std::string(LIBRARYDIR).c_str(); QDir dir(QString::fromStdString(path)); if (dir.isAbsolute()) return path; @@ -1154,7 +1156,8 @@ std::string Application::getLibraryDir() std::string Application::getHelpDir() { #ifdef DOCDIR - std::string path(DOCDIR); + // #6892: Conda may inject null characters => remove them + std::string path = std::string(DOCDIR).c_str(); path.append("/"); QDir dir(QString::fromStdString(path)); if (dir.isAbsolute())