PMunch / mpfshell

A simple shell based file explorer for ESP8266 Micropython based devices
MIT License
8 stars 2 forks source link

getr command fails with . as remote directory #2

Open fredrikhr opened 7 years ago

fredrikhr commented 7 years ago

When executing the getr command without arguments, it responds with:

Missing arguments: <REMOTE DIRECTORY> [<LOCAL DIRECTORY>]

When specifying . as the remote directory the following happens:

mpfs [...]> getr .
Traceback (most recent call last):
  File "...\mpfshell\mpfshell", line 8, in <module>
    main()
  File "...\mpfshell\mp\mpfshell.py", line 825, in main
    mpfs.cmdloop()
  File "...\Python27\lib\cmd.py", line 142, in cmdloop
    stop = self.onecmd(line)
  File "...\Python27\lib\cmd.py", line 221, in onecmd
    return func(arg)
  File "...\mpfshell\mp\mpfshell.py", line 521, in do_getr
    self.fe.getr(src=s_args[0], dst=(s_args[1] if len(s_args)>1 else None))
  File "...\mpfshell\mp\mpfexp.py", line 414, in getr
    res = self.eval_with_exception("os.stat('%s')" % self._fqn(src))
  File "...\mpfshell\mp\pyboard.py", line 190, in eval_with_exception
    self.throw_exception_on_error(ret,ret_err)
  File "...\mpfshell\mp\pyboard.py", line 184, in throw_exception_on_error
    raise PyboardError('exception',ret, ret_err)
mp.pyboard.PyboardError: ('exception', '', "('OSError',(22,))\x1f")
PMunch commented 7 years ago

It seems that the function self._fqn (for fully qualified name) in mpfexp.py doesn't support . and .. directories. So this should either be converted to an error message or support should be added.

fredrikhr commented 7 years ago

When . works, it would be nice if that was the default remote directory (instead of the error)