diff options
| author | Andrew Leech <andrew.leech@planetinnovation.com.au> | 2022-02-01 10:52:55 +1100 |
|---|---|---|
| committer | Damien George <damien@micropython.org> | 2022-02-04 14:58:29 +1100 |
| commit | 1f84440538a017e463aaad9686831ce9527122b5 (patch) | |
| tree | 9237c9bf04e12b022342183e3a559ac6b700b33f | |
| parent | a7530cbc03ba3ca4a70f7d3bd6b2e27656c25173 (diff) | |
tools/mpremote: Fix "fs cp -r" on Windows.
A backslash in the directory name will end up being passed through to the
device and becoming a backslash in a filename, rather than being
interpreted as directories. This makes "cp -r" problematic on Windows.
Changing to simply "/",join() fixes this.
| -rw-r--r-- | tools/mpremote/mpremote/main.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/tools/mpremote/mpremote/main.py b/tools/mpremote/mpremote/main.py index 13615f6dd..5c6362558 100644 --- a/tools/mpremote/mpremote/main.py +++ b/tools/mpremote/mpremote/main.py @@ -268,7 +268,7 @@ def do_filesystem(pyb, args): def _list_recursive(files, path): if os.path.isdir(path): for entry in os.listdir(path): - _list_recursive(files, os.path.join(path, entry)) + _list_recursive(files, "/".join((path, entry))) else: files.append(os.path.split(path)) @@ -289,7 +289,7 @@ def do_filesystem(pyb, args): if d not in known_dirs: pyb.exec_("try:\n uos.mkdir('%s')\nexcept OSError as e:\n print(e)" % d) known_dirs.add(d) - pyboard.filesystem_command(pyb, ["cp", os.path.join(dir, file), ":" + dir + "/"]) + pyboard.filesystem_command(pyb, ["cp", "/".join((dir, file)), ":" + dir + "/"]) else: pyboard.filesystem_command(pyb, args) args.clear() |
