mirror of
https://github.com/markqvist/Reticulum.git
synced 2024-11-05 05:40:14 +00:00
File transfer example
This commit is contained in:
parent
5d977e09fb
commit
6cb30d778d
@ -413,18 +413,21 @@ def download_concluded(resource):
|
||||
global menu_mode, current_filename
|
||||
saved_filename = current_filename
|
||||
|
||||
counter = 0
|
||||
while os.path.isfile(saved_filename):
|
||||
counter += 1
|
||||
saved_filename = current_filename+"."+str(counter)
|
||||
if resource.status == RNS.Resource.COMPLETE:
|
||||
counter = 0
|
||||
while os.path.isfile(saved_filename):
|
||||
counter += 1
|
||||
saved_filename = current_filename+"."+str(counter)
|
||||
|
||||
try:
|
||||
file = open(saved_filename, "w")
|
||||
file.write(resource.data)
|
||||
file.close()
|
||||
try:
|
||||
file = open(saved_filename, "w")
|
||||
file.write(resource.data)
|
||||
file.close()
|
||||
menu_mode = "download_concluded"
|
||||
except:
|
||||
menu_mode = "save_error"
|
||||
else:
|
||||
menu_mode = "download_concluded"
|
||||
except:
|
||||
menu_mode = "save_error"
|
||||
|
||||
|
||||
# A convenience function for clearing the screen
|
||||
|
Loading…
Reference in New Issue
Block a user