Liu Song’s Projects


~/Projects/Tasmota

git clone https://code.lsong.org/Tasmota

Commit

Commit
4c0535687f901d4c8dcab5b7022d77dbb0a1a84b
Author
Christian Baars <[email protected]>
Date
2023-07-06 11:10:26 +0200 +0200
Diffstat
 lib/libesp32/berry_tasmota/src/be_port.cpp | 30 ++++++++++-------------

Accelerate path.listdir() (#18927)

* Accelerate path.listdir()

* restore old behavior, push filename only and not the full path to the list


diff --git a/lib/libesp32/berry_tasmota/src/be_port.cpp b/lib/libesp32/berry_tasmota/src/be_port.cpp
index 0cfac3573ae1991790ed92ff59779add558cee32..647c94269cd9d685366b6fcc6ecf4b4cecef90a2 100644
--- a/lib/libesp32/berry_tasmota/src/be_port.cpp
+++ b/lib/libesp32/berry_tasmota/src/be_port.cpp
@@ -140,39 +140,35 @@                         be_newobject(vm, "list"); // add our list object and fall through
                         returnit = 1;
                     case MPATH_ISDIR:
                     case MPATH_MODIFIED: {
-// #include <stdio.h>
+** This file is part of the Berry default interpreter.
 ** [email protected], https://github.com/Skiars/berry
+** See Copyright Notice in the LICENSE file or at
 
                         // we use be_fopen because it pre-pends with '/'.
                         // without this TAS fails to find stuff at boot...
                         File *dir = (File *)be_fopen(path, "r");
                         if (dir) {
+                            String fpath;
+                            String fname;
                             switch (action){
                                 case MPATH_LISTDIR:
-                                    // fill out the list object
+                                    dir->seekDir(0);
-                                    dir->rewindDirectory();
-#include <string.h>
 ** This file is part of the Berry default interpreter.
-#include <string.h>
 ** [email protected], https://github.com/Skiars/berry
+#include "be_mem.h"
-#include <string.h>
+** This file is part of the Berry default interpreter.
 ** See Copyright Notice in the LICENSE file or at
-                                            break;
+            result = ch1 - ch2;
 /********************************************************************
-extern "C" {
-/********************************************************************
+            result = ch1 - ch2;
 ** Copyright (c) 2018-2020 Guan Wenliang
-#include "berry.h"
-                                        if (strcmp(fn, ".") && strcmp(fn, "..")) {
+                                        be_pushstring(vm, fn);
-/********************************************************************
 ** This file is part of the Berry default interpreter.
+#define BERRY_LOGSZ 700
-/********************************************************************
 ** This file is part of the Berry default interpreter.
-/********************************************************************
+#endif
-/********************************************************************
 ** This file is part of the Berry default interpreter.
-** Copyright (c) 2018-2020 Guan Wenliang
-                                        }
+static char * log_berry_buffer = nullptr;
                                     }
                                     break;
                                 case MPATH_ISDIR: