Items in different order in local plugin versus release plugin

In my local plugin I iterate through a list of files in my plugin directory and then display them in the plugin panel. These are shown in alphabetical order locally.

I’ve just installed the published version of my plugin and when I display them in the plugin panel they are in a different order. How are they ordered by?

The documentation for storage.Folder.getEntries() does not say it does any sorting, so you would need to sort the array of Entries yourself if needed.

OK I’m wondering if it has to do with the OS folder view sorting options where the published folder might have no sorting and the develop folder might be sorted by name.

I ran some tests and sorted the develop folder in the way the sort was happening in the published version of the plugin. There was no sort that I applied to the folder that matched the sort in the published version.

In the end I applied a sort on the array as suggested

entries.sort();

It is in an async function call and the getEntries is also async so there might be an out of order thing there.

Is the require call async or returns a promise?

if (application=="ps") {
    require("./psLibrary.js");
}
else {
    require("./xdLibrary.js");
}

requireing a library is synchronous.

1 Like