MCPcopy Create free account
hub / github.com/bmorcelli/Launcher / sortList

Function sortList

src/sd_functions.cpp:229–242  ·  view source on GitHub ↗

** Function name: sortList ** Description: sort files/folders by name ***************************************************************************************/

Source from the content-addressed store, hash-verified

227** Description: sort files/folders by name
228***************************************************************************************/
229bool sortList(const Option &a, const Option &b) {
230 const uint16_t _folderColor = uint16_t(FGCOLOR - 0x1111);
231 bool _a = (a.color == _folderColor); // is folder
232 bool _b = (b.color == _folderColor); // is folder
233 if (_a != _b) {
234 return _a > _b; // true if a is a folder and b is not
235 }
236 // Order items alphabetically
237 String fa = a.label;
238 fa.toUpperCase();
239 String fb = b.label;
240 fb.toUpperCase();
241 return fa < fb;
242}
243
244/***************************************************************************************
245** Function name: readFs

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected