MINGW-packages/mingw-w64-texstudio/0002-texstudio-4.2.2-fallbackpaths-win32-as-unix.patch
2025-09-14 11:08:21 +01:00

41 lines
1.8 KiB
Diff

--- a/src/configmanager.cpp
+++ b/src/configmanager.cpp
@@ -916,9 +916,9 @@
#endif
fallBackPaths << PREFIX"/share/hunspell" << PREFIX"/share/myspell"
<< "/usr/share/hunspell" << "/usr/share/myspell"
- << parseDir("[txs-app-dir]/../share/texstudio")
<< parseDir("[txs-app-dir]/../usr/share/texstudio") ;
#endif
+ fallBackPaths << parseDir("[txs-app-dir]/../share/texstudio");
#ifdef Q_OS_MAC
fallBackPaths << parseDir("[txs-app-dir]/../Resources") << "/Applications/texstudio.app/Contents/Resources";
#endif
@@ -957,8 +957,10 @@
QStringList fallBackPaths;
#ifdef Q_OS_LINUX
fallBackPaths << PREFIX"/share/mythes" << "/usr/share/mythes"
- << parseDir("[txs-app-dir]/../share/texstudio")
<< parseDir("[txs-app-dir]/../usr/share/texstudio") ;
+#endif
+#if defined(Q_OS_LINUX) || defined(Q_OS_WIN32)
+ fallBackPaths << parseDir("[txs-app-dir]/../share/texstudio");
#endif
thesaurus_database = findResourceFile("th_" + QString(QLocale::system().name()) + "_v2.dat", true, preferredPaths, fallBackPaths);
if (thesaurus_database == "") thesaurus_database = findResourceFile("th_en_US_v2.dat", true, preferredPaths, fallBackPaths);
--- a/src/templatemanager.cpp
+++ b/src/templatemanager.cpp
@@ -27,7 +27,11 @@ QString TemplateManager::builtinTemplateDir()
return fn;
#endif
#ifdef Q_OS_WIN
- return QCoreApplication::applicationDirPath() + "/templates/";
+ QString fn = QCoreApplication::applicationDirPath() + "/../share/texstudio/";
+ if (!QDir(fn).isReadable()) { // fallback if program is not packaged as app (e.g. debug build )
+ return QCoreApplication::applicationDirPath() + "/templates/";
+ }
+ return fn;
#else
#if !defined(PREFIX)
#define PREFIX ""