diff --git a/include/system.hpp b/include/system.hpp index 94fbaec2..155a4018 100644 --- a/include/system.hpp +++ b/include/system.hpp @@ -12,7 +12,9 @@ namespace rack { namespace system { -/** Returns a list of all entries (directories, files, symbols) in a directory. */ +/** Returns a list of all entries (directories, files, symbols) in a directory. +Sorted alphabetically. +*/ std::list getEntries(const std::string& path); std::list getEntriesRecursive(const std::string &path, int depth); /** Returns whether the given path is a file. */ diff --git a/src/app/ModuleWidget.cpp b/src/app/ModuleWidget.cpp index 1451905b..b0a4d569 100644 --- a/src/app/ModuleWidget.cpp +++ b/src/app/ModuleWidget.cpp @@ -1,4 +1,5 @@ #include +#include #include @@ -243,8 +244,13 @@ struct ModulePresetItem : ui::MenuItem { continue; hasPresets = true; + std::string presetName = string::filenameBase(presetFilename); + // Remove "1_", "42_", "001_", etc at the beginning of preset filenames + std::regex r("^\\d*_"); + presetName = std::regex_replace(presetName, r, ""); + ModulePresetPathItem* presetItem = new ModulePresetPathItem; - presetItem->text = string::filenameBase(presetFilename); + presetItem->text = presetName; presetItem->presetPath = presetPath; presetItem->moduleWidget = moduleWidget; menu->addChild(presetItem);