mpremote gives false error if a destination directory doesn't exist for recursive copy
Port, board and/or hardware
rp2040
MicroPython version
MicroPython v1.24.0 on 2024-10-25; Raspberry Pi Pico with RP2040
Reproduction
create a directory 'test' on the target and 'local' on host
then run:
mpremote cp -r local :testt
note typo in destination
Expected behaviour
the error message should be 'destination doesn't exist'
Observed behaviour
cp local :testt
mpremote: cp: -r not specified; omitting directory
Additional Information
No, I've provided everything above.
Code of Conduct
Yes, I agree
tools/mpremote: Support trailing slash on dest for non-recursive copy.
Summary
This fixes a regression in db59e55fe7a0b67d3af868990468e7b8056afe42: prior to that commit mpremote supported trailing slashes on the destination of a normal (non-recursive) copy.
Add back support for that, with the semantics that a trailing slash requires the destination to be an existing directory.
Testing
A test has been added to the mpremote tests (also a test for force copy, in a separate commit). As part of getting the test working, needed to flush stdout before printing error messages to stderr.
The mpremote tests were then run on a PYBD_SF2. They passed.