File IO system doesn't work when plugin is run from MuseScore
Hi. I have this problem. I have the JSON file on disk and when plugin starts the data from file should be parsed to array. Here is a fragment of code.
import FileIO 1.0
FileIO {
id: dataFile
onError: console.log(msg)
}
property var array: []
function loadData() {
dataFile.setSource("D:/test.txt");
array = JSON.parse(dataFile.read())
}
onRun: {
loadData();
}
When I run it in plugin creator mode, it works! Proper outputs to console etc. But when I run this plugin from MuseScore plugin manager - it doesn't work. I hope someone can help me.
Comments
There are other things which work in the Plugin Creator and do not from MuseScore directly; for instance, see #72416: Plug-in code working differently when called directly and when run under Plugin Creator.
Apparently, the Plugin Creator does some additional environment setup, which the programme does not do by itself, but nobody could point it down. And nobody (else?) seemed to care overmuch so far...
In reply to There are other things which by Miwarre
Thanks. I solved the problem by moving loadData() function from onRun to onPaint of canvas.