[API]Creation of folders with the PluginAPI.writeScore method

• Sep 6, 2022 - 23:15
Reported version
3.6
Type
Plugins
Frequency
Few
Severity
S5 - Suggestion
Reproducibility
Always
Status
active
Regression
No
Workaround
No
Project

When attempting to write a score located on a folder that doesn't exist with PluginAPI.writeScore, an error is raised.
The request is about having this method creating all the necessary folders instead of failing.

var target="path/to/somewhere/idontexist/myscore.pdf"
if (!writeScore(curScore, target, "pdf") // --> return false, and the file "myscore.pdf" does not exist
console.log("Could not write " + target);
}

This request comes after the discussion Creating folders from a plugin.

It appears that there is no ways in QML/javascript to create folders (see this question on Stack Overflow).

The current workaround is non platform-agnostic solution that should therefore avoide.

The recommended approach is to delegate these tasks to backend objects.
PluginAPI.writeScore is good candidate for this.


Comments

The issue you are mentioning is a bug of those methods within MS4. This one is feature request. Not a bug. The request is to have writeScore creating the intermediate folders if they don't exist. IMO, not the same, but related.