wendlers / mpfshell

A simple shell based file explorer for ESP8266 Micropython based devices ⛺
MIT License
396 stars 84 forks source link

Save/restore current path before/after entering REPL #88

Closed codefreax closed 4 years ago

codefreax commented 4 years ago

Without these changes, mpfshell returns to the fs root, i.e. /, when returning from REPL, but still displays the original path from before REPL in the prompt. One commit makes sure the correct path is displayed in the prompt when returning from REPL. The other commit restores the path from before REPL, if it still exists.

skorokithakis commented 4 years ago

This looks good, thanks! I only have a small documentation comment.

codefreax commented 4 years ago

Testing:

mpfs [/]> md foo
mpfs [/]> cd foo
mpfs [/foo]> repl
>
*** Exit REPL with Ctrl+] ***

MicroPython v1.12-124-g4a18ea439 on 2020-02-02; ESP32 module (spiram) with ESP32
Type "help()" for more information.
>>> import os
>>> os.getcwd()
'/'
>>> os.listdir('/')
['boot.py', 'foo']
>>> os.rmdir('/foo')
>>> os.listdir('/')
['boot.py']
>>>

No such directory: /foo

mpfs [/]> 
skorokithakis commented 4 years ago

Looks great, thank you!