1 /************************************************************************ 2 ** 3 ** Copyright (C) 2015-2020 Kevin B. Hendricks, Stratford Ontario Canada 4 ** Copyright (C) 2015-2021 Doug Massay 5 ** Copyright (C) 2009-2011 Strahinja Markovic <strahinja.markovic@gmail.com> 6 ** 7 ** This file is part of Sigil. 8 ** 9 ** Sigil is free software: you can redistribute it and/or modify 10 ** it under the terms of the GNU General Public License as published by 11 ** the Free Software Foundation, either version 3 of the License, or 12 ** (at your option) any later version. 13 ** 14 ** Sigil is distributed in the hope that it will be useful, 15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of 16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 ** GNU General Public License for more details. 18 ** 19 ** You should have received a copy of the GNU General Public License 20 ** along with Sigil. If not, see <http://www.gnu.org/licenses/>. 21 ** 22 *************************************************************************/ 23 24 #include <QString> 25 #include <QStringList> 26 #include "sigil_constants.h" 27 28 #if _WIN32 29 #include <QProcessEnvironment> 30 31 // Windows barks about getenv or _wgetenv. This elicits no warnings and works with unicode paths 32 const QString SIGIL_PREFS_DIR = QProcessEnvironment::systemEnvironment().value("SIGIL_PREFS_DIR", "").trimmed(); 33 34 const QString PATH_LIST_DELIM = ";"; 35 const QString PYTHON_MAIN_PATH = ""; // Bundled Python interpreter is in same dir as Sigil exe now 36 const QStringList PYTHON_SYS_PATHS = QStringList() << "/Lib" << "/DLLs" << "/Lib/site-packages"; 37 #else 38 const QString SIGIL_PREFS_DIR = QString(getenv("SIGIL_PREFS_DIR")); 39 #endif 40 41 // CMAKE configuration -DDISABLE_UPDATE_CHECK (0 or 1) 42 const bool DONT_CHECK_FOR_UPDATES = DONT_CHECK_UPDATES; 43 44 #if __APPLE__ 45 const QString PATH_LIST_DELIM = ":"; 46 const QString PYTHON_MAIN_PREFIX = "/Frameworks/Python.framework/Versions/3.8"; 47 const QString PYTHON_MAIN_BIN_PATH = PYTHON_MAIN_PREFIX + "/bin/python3"; 48 const QString PYTHON_LIB_PATH = "/lib/python3.8"; 49 const QString PYTHON_SITE_PACKAGES = PYTHON_MAIN_PREFIX + PYTHON_LIB_PATH + "/site-packages"; 50 const QStringList PYTHON_SYS_PATHS = QStringList () << "/lib-dynload" << "/site-packages"; 51 #endif 52 53 #if !defined(_WIN32) && !defined(__APPLE__) 54 const QString PATH_LIST_DELIM = ":"; 55 // Runtime env var override of Sigil's 'share/sigil' directory 56 const QString sigil_extra_root = QString(getenv("SIGIL_EXTRA_ROOT")); 57 // Runtime env var override of hunspell dictionaries directory to use 58 const QString hunspell_dicts_override = QString(getenv("SIGIL_DICTIONARIES")); 59 // Runtime env var to force the use of Sigil's darkmode palette instead of platform QPA themes/styles 60 const QString force_sigil_darkmode_palette = QString(getenv("FORCE_SIGIL_DARKMODE_PALETTE")); 61 // Standard build-time location of Sigil's 'share/sigil' directory. Set in src/CMakeLists.txt with the line: 62 // set_source_files_properties( sigil_constants.cpp PROPERTIES COMPILE_DEFINITIONS SIGIL_SHARE_ROOT="${SIGIL_SHARE_ROOT}" ) 63 const QString sigil_share_root = QString(SIGIL_SHARE_ROOT); 64 const bool dicts_are_bundled = DICTS_ARE_BUNDLED; 65 const QString extra_dict_dirs = QString(EXTRA_DICT_DIRS); 66 const QString mathjax_dir = QString(MATHJAX_DIR); 67 const QString PYTHON_MAIN_PATH = "/python3/lib/python3.5"; 68 #if __x86_64__ || __ppc64__ 69 const QStringList PYTHON_SYS_PATHS = QStringList () << "/plat-x86_64-linux-gnu" << "/plat-linux" << "/lib-dynload" << "/site-packages"; 70 #else 71 const QStringList PYTHON_SYS_PATHS = QStringList () << "/plat-i386-linux-gnu" << "/plat-linux" << "/lib-dynload" << "/site-packages"; 72 #endif 73 #endif 74