File: share-dir.diff

package info (click to toggle)
musescore3 3.2.3%2Bdfsg2-21
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 219,852 kB
  • sloc: cpp: 291,412; xml: 200,226; sh: 3,779; ansic: 1,447; python: 393; makefile: 246; perl: 82; pascal: 79
file content (95 lines) | stat: -rw-r--r-- 4,124 bytes parent folder | download
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
Description: add --share-folder (analogous --config-folder),
 use it during the tests to have workspaces to avoid an assertion failure
Author: mirabilos <tg@debian.org>
Forwarded: not-yet

--- a/build/Linux+BSD/mscore.1.in
+++ b/build/Linux+BSD/mscore.1.in
@@ -3,7 +3,7 @@
 .\"	mirabilos <m@mirbsd.org>
 .\" Published under the same terms as MuseScore itself.
 .\"-
-.Dd April 22, 2025
+.Dd October 7, 2025
 .Dt @MAN_MSCORE_UPPER@ 1
 .Os MuseScore
 .Sh NAME@Variables_substituted_by_CMAKE_on_installation@
@@ -49,6 +49,7 @@
 .Op Fl \-score\-media
 .Op Fl \-score\-mp3
 .Op Fl \-score\-parts\-pdf
+.Op Fl \-share\-folder Ar dir
 .Op Fl \-template\-mode
 .Op Fl \-test\-mode
 .Op Fl \-version
@@ -256,6 +257,12 @@ as a single JSON document to stdout
 .It Fl \-score\-parts\-pdf
 Generates parts data for the given score and exports it
 as a single JSON document to stdout
+.It Fl \-share\-folder Ar dir
+If
+.Ar dir
+is the empty string, show the value of the shared data path
+.Pq normally Pa @CMAKE_INSTALL_PREFIX@/@Mscore_SHARE_NAME@@Mscore_INSTALL_NAME@ ;
+otherwise, the argument is used as shared data path.
 .It Fl \-template\-mode
 Save files in template mode (e.g. without page sizes)
 .El
--- a/mscore/musescore.cpp
+++ b/mscore/musescore.cpp
@@ -7365,6 +7365,7 @@ int main(int argc, char* av[])
       parser.addOption(QCommandLineOption({"j", "job"}, "Process a conversion job", "file"));
       parser.addOption(QCommandLineOption({"e", "experimental"}, "Enable experimental features"));
       parser.addOption(QCommandLineOption({"c", "config-folder"}, "Override configuration and settings folder", "dir"));
+      parser.addOption(QCommandLineOption(      "share-folder", "Override install path", "dir"));
       parser.addOption(QCommandLineOption({"t", "test-mode"}, "Set test mode flag for all files")); // this includes --template-mode
       parser.addOption(QCommandLineOption("run-test-script", "Run script tests listed in the command line arguments"));
       parser.addOption(QCommandLineOption({"M", "midi-operations"}, "Specify MIDI import operations file", "file"));
@@ -7553,6 +7554,18 @@ int main(int argc, char* av[])
       QStringList argv = parser.positionalArguments();
 
       mscoreGlobalShare = getSharePath();
+      if (parser.isSet("share-folder")) {
+            QString path = parser.value("share-folder");
+            if (path.isEmpty())
+                  qInfo("builtin path: %s", qPrintable(mscoreGlobalShare));
+            else {
+                  QDir dir(path);
+
+                  if (!dir.exists(path))
+                        qFatal("--share-folder does not exist");
+                  mscoreGlobalShare = dir.absolutePath() + "/";
+                  }
+            }
       iconPath = externalIcons ? mscoreGlobalShare + QString("icons/") :  QString(":/data/icons/");
 
       if (!converterMode && !pluginMode) {
@@ -7596,9 +7609,6 @@ int main(int argc, char* av[])
       // if not already there:
       QDir().mkpath(dataPath + "/plugins");
 
-      if (MScore::debugMode)
-            qDebug("global share: <%s>", qPrintable(mscoreGlobalShare));
-
       // set translator before Shortcut are initialized to get translations for all shortcuts
       // can not use preferences to retrieve these values as it needs to be initialized after translator is set
       if (useFactorySettings)
--- a/mtest/testscript/CMakeLists.txt
+++ b/mtest/testscript/CMakeLists.txt
@@ -15,4 +15,5 @@ set(TARGET tst_runscripts)
 include(${PROJECT_SOURCE_DIR}/mtest/cmake.inc)
 
 add_dependencies(tst_runscripts mscore)
+add_dependencies(tst_runscripts workspaces)
 add_definitions(-DMSCORE_EXECUTABLE_PATH="$<TARGET_FILE:mscore>")
--- a/mtest/testscript/tst_runscripts.cpp
+++ b/mtest/testscript/tst_runscripts.cpp
@@ -60,7 +60,7 @@ void TestScripts::runTestScripts()
       cwd.setSorting(QDir::Name);
       QStringList scripts = cwd.entryList();
 
-      QStringList args({ "--run-test-script" });
+      QStringList args({ "--share-folder", QT_TESTCASE_BUILDDIR "/share", "--run-test-script" });
       args << scripts;
 
       if (!QFileInfo(MSCORE_EXECUTABLE_PATH).exists())