Skip to content

Commit

Permalink
fixed parse old plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Jul 2, 2024
1 parent 6bf548a commit 4d6ee74
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/framework/extensions/internal/legacy/extpluginsloader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,45 @@ Manifest ExtPluginsLoader::parseManifest(const io::path_t& rootPath, const io::p
String uiCtx = DEFAULT_UI_CONTEXT;
int needProperties = 6; // title, description, pluginType, category, thumbnail, requiresScore
int propertiesFound = 0;
bool insideMuseScoreItem = false;
String content = String::fromUtf8(data);
size_t current, previous = 0;
current = content.indexOf(u"\n");

//! NOTE Supposed structure
//! // comments
//! import ...
//! import ...
//!
//! MuseScore {
//!
//! prop1: ...
//! prop2: ...
//! ...
//!
//! As soon as the first open bracket is encountered,
//! we consider that the properties have ended.
//! Technically, there may be properties further down,
//! we just need to ask to move them up.
//!
//! onRun: {..
//! function applyMirrorIntervals() {..
//! Item { ...
//!

while (current != std::string::npos) {
String line = content.mid(previous, current - previous).trimmed();

if (line.startsWith(u'/')) { // comment
// noop
} else if (line.endsWith(u'{')) {
if (insideMuseScoreItem) {
break;
}

if (!insideMuseScoreItem) {
insideMuseScoreItem = true;
}
} else if (line.startsWith(u"title:")) {
m.title = dropQuotes(line.mid(6).trimmed());
++propertiesFound;
Expand Down

0 comments on commit 4d6ee74

Please sign in to comment.