Saving files in 2.0

• Nov 17, 2014 - 12:04

Hey,
I've seen that it's possible to save files with the 1.0 Plugin API using QFile, but when I attempt to do it in 2.0 it seems that there is no binding to QFile (new QFile throws an exception). Is that correct or am I missing something?


Comments

Ok never mind I figured it out by RTFS and a little bit of Googling.
In case anyone else has this question:

In your QML:

1) import FileIO 1.0

then within the MuseScore block:
FileIO {
id: file
onError: console.log(msg)
}

set a source file:
file.setSource("/Users/sexy/Documents/test.tmp");
read:
var fileContents = file.read()
to write:
file.write("content")

you can also use the methods:
exists, remove and tempPath

Do you still have an unanswered question? Please log in first to post your question.