Skip to content

Commit 17434e9

Browse files
committed
Fix copy folder in camflasher
1 parent 94a2868 commit 17434e9

File tree

7 files changed

+108
-95
lines changed

7 files changed

+108
-95
lines changed

modules/lib/motion/historic.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ async def extract():
187187
async def scan_dir(path, pattern, older=True, directory=True):
188188
""" Scan directory """
189189
result = []
190-
for fileinfo in uos.ilistdir(path):
190+
for fileinfo in filesystem.list_directory(path):
191191
name = fileinfo[0]
192192
typ = fileinfo[1]
193193
if directory:
@@ -267,7 +267,7 @@ async def remove_files(directory, simulate=False, force=False):
267267
dirs_to_remove = []
268268

269269
# Parse all directories in sdcard (WARNING : TO AVOID CRASH, NEVER DELETE DIRECTORY OR FILE IN ilistdir LOOP)
270-
for fileinfo in uos.ilistdir(directory):
270+
for fileinfo in filesystem.list_directory(directory):
271271
filename = fileinfo[0]
272272
typ = fileinfo[1]
273273
# If file found

modules/lib/server/ftpservercore.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ def send_file_list_with_pattern(self, path, stream_, full, now, pattern=None):
100100
description = b""
101101
quantity = 0
102102
counter = 0
103-
for fileinfo in uos.ilistdir(strings.tostrings(path)):
103+
for fileinfo in filesystem.list_directory(strings.tostrings(path)):
104104
filename = fileinfo[0]
105105
typ = fileinfo[1]
106106
if len(fileinfo) > 3:

modules/lib/tools/builddate.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
''' Build date '''
2-
date=b'2023/02/05 14:05:02'
2+
date=b'2023/02/05 16:28:55'

modules/lib/tools/filesystem.py

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,29 @@ def ismicropython():
173173
return True
174174
return False
175175

176+
try:
177+
import uos
178+
list_directory = uos.ilistdir
179+
except:
180+
def list_directory(path_):
181+
""" List directory """
182+
result = []
183+
for filename in os.listdir(path_):
184+
fileinfo_ = os.stat(path_ + "/" + filename)
185+
typ = fileinfo_[0]
186+
size = fileinfo_[6]
187+
188+
result.append((filename, typ, 0, size))
189+
return result
190+
176191
def scandir(path, pattern, recursive, displayer=None):
177192
""" Scan recursively a directory """
178193
filenames = []
179194
directories = []
180195
if path == "":
181196
path = "."
182197
if path is not None and pattern is not None:
183-
for file_info in uos.ilistdir(path):
198+
for file_info in list_directory(path):
184199
name = file_info[0]
185200
typ = file_info[1]
186201
if path != "":
@@ -217,7 +232,7 @@ async def ascandir(path, pattern, recursive, displayer=None):
217232
if path == "":
218233
path = "."
219234
if path is not None and pattern is not None:
220-
for file_info in uos.ilistdir(path):
235+
for file_info in list_directory(path):
221236
name = file_info[0]
222237
typ = file_info[1]
223238
if path != "":

modules/lib/tools/jsonconfig.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def list_all(self):
6363
""" List all configuration files """
6464
result = []
6565
pattern = self.get_filename() + ".*"
66-
for fileinfo in uos.ilistdir(self.config_root()):
66+
for fileinfo in filesystem.list_directory(self.config_root()):
6767
name = fileinfo[0]
6868
typ = fileinfo[1]
6969
if typ & 0xF000 != 0x4000:

modules/lib/tools/lang_english.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -206,4 +206,3 @@
206206
month_format =b"%(year)d %(month)s"
207207
weekdays = [monday,tuesday,wednesday,thursday,friday,saturday,sunday]
208208
months = [january,february,march,april,may,june,july,august,september,october,november,december]
209-
activation_precaution =b"The camera should be activated only when you are connected to your wifi network. When the wifi access point mode is active with camera then this produces instabilities."

modules/lib/tools/lang_french.py

Lines changed: 86 additions & 87 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)