kopia lustrzana https://github.com/micropython/micropython
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.pull/8239/head
rodzic
a7530cbc03
commit
1f84440538
|
@ -268,7 +268,7 @@ def do_filesystem(pyb, args):
|
||||||
def _list_recursive(files, path):
|
def _list_recursive(files, path):
|
||||||
if os.path.isdir(path):
|
if os.path.isdir(path):
|
||||||
for entry in os.listdir(path):
|
for entry in os.listdir(path):
|
||||||
_list_recursive(files, os.path.join(path, entry))
|
_list_recursive(files, "/".join((path, entry)))
|
||||||
else:
|
else:
|
||||||
files.append(os.path.split(path))
|
files.append(os.path.split(path))
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ def do_filesystem(pyb, args):
|
||||||
if d not in known_dirs:
|
if d not in known_dirs:
|
||||||
pyb.exec_("try:\n uos.mkdir('%s')\nexcept OSError as e:\n print(e)" % d)
|
pyb.exec_("try:\n uos.mkdir('%s')\nexcept OSError as e:\n print(e)" % d)
|
||||||
known_dirs.add(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:
|
else:
|
||||||
pyboard.filesystem_command(pyb, args)
|
pyboard.filesystem_command(pyb, args)
|
||||||
args.clear()
|
args.clear()
|
||||||
|
|
Ładowanie…
Reference in New Issue