All Classes Namespaces Functions Variables Enumerations Properties Pages
linux.cpp
1 /*
2 
3 Pencil2D - Traditional Animation Software
4 Copyright (C) 2005-2007 Patrick Corrieri & Pascal Naidon
5 Copyright (C) 2009 Mj Mendoza IV
6 Copyright (C) 2012-2020 Matthew Chiawen Chang
7 
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; version 2 of the License.
11 
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16 
17 */
18 
19 #include <QDebug>
20 #include "platformhandler.h"
21 
22 namespace PlatformHandler
23 {
24  void configurePlatformSpecificSettings() {}
25 
26  void initialise()
27  {
28  /* If running as an AppImage, sets GStreamer environment variables to ensure
29  * the plugins contained in the AppImage are found
30  */
31  QString appDir = QString::fromLocal8Bit(qgetenv("APPDIR"));
32  if (!appDir.isEmpty())
33  {
34  bool success = qputenv("GST_PLUGIN_SYSTEM_PATH_1_0",
35  QString("%1/usr/lib/gstreamer-1.0:%2")
36  .arg(appDir, QString::fromLocal8Bit(qgetenv("GST_PLUGIN_SYSTEM_PATH_1_0")))
37  .toLocal8Bit());
38  success = qputenv("GST_PLUGIN_SCANNER_1_0",
39  QString("%1/usr/lib/gstreamer1.0/gstreamer-1.0/gst-plugin-scanner")
40  .arg(appDir).toLocal8Bit()) && success;
41  if (!success)
42  {
43  qWarning() << "Unable to set up GStreamer environment";
44  }
45  }
46  }
47 }
QString fromLocal8Bit(const char *str, int size)
bool isEmpty() const const