Plugin Bug curScore.path; after FIRST save

• Apr 29, 2021 - 09:21
Reported version
3.6
Type
Plugins
Frequency
Once
Severity
S4 - Minor
Reproducibility
Always
Status
active
Regression
No
Workaround
Yes
Project

Using curScore.path; will not return the file path after the first save. Unless the user reopen the file then it works.

Plugins to consider:

Mac:

import QtQuick 2.0
import MuseScore 3.0
MuseScore {
      menuPath: "Plugins.MIDI Exporter"
      description: "Description goes here"
      version: "1.1"
      onRun: {
            var s = curScore 
            var p = curScore.path;
            p = p.slice(0, -5);
            writeScore(s, p, 'mid')
            }
      }

Win :

import QtQuick 2.0
import MuseScore 3.0
MuseScore {
      menuPath: "Plugins.MIDI Exporter"
      description: "Description goes here"
      version: "1.1"
      onRun: {
            var s = curScore 
            var p = curScore.path;
            p = p.slice(0, -5);
            p = p.replace(/\//gi,"\\")
            writeScore(s, p, 'mid')
            }
      }

Steps:
1) Create a new file
2) Save it somewhere

3) Try to run a script and see the result of curScore.path; OR try to run the plugin above to save a .mid file at file path. (It won't find the path)

Workaround is reopen the file after the first save and run the plugin again than it will work :D

Edit: idk why the post got some bigger font size at step 3 O.o


Comments