forked from platformio/platformio-core
Use "path" instead of "device" for logical devices
This commit is contained in:
2
docs
2
docs
Submodule docs updated: 8486fccd50...0403f687d6
@ -108,17 +108,17 @@ def AutodetectUploadPort(*args, **kwargs): # pylint: disable=unused-argument
|
|||||||
def _look_for_mbed_disk():
|
def _look_for_mbed_disk():
|
||||||
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
||||||
for item in util.get_logical_devices():
|
for item in util.get_logical_devices():
|
||||||
if item['device'].startswith("/net") or not _is_match_pattern(
|
if item['path'].startswith("/net") or not _is_match_pattern(
|
||||||
item['device']):
|
item['path']):
|
||||||
continue
|
continue
|
||||||
mbed_pages = [
|
mbed_pages = [
|
||||||
join(item['device'], n) for n in ("mbed.htm", "mbed.html")
|
join(item['path'], n) for n in ("mbed.htm", "mbed.html")
|
||||||
]
|
]
|
||||||
if any([isfile(p) for p in mbed_pages]):
|
if any([isfile(p) for p in mbed_pages]):
|
||||||
return item['device']
|
return item['path']
|
||||||
if item['name'] \
|
if item['name'] \
|
||||||
and any([l in item['name'].lower() for l in msdlabels]):
|
and any([l in item['name'].lower() for l in msdlabels]):
|
||||||
return item['device']
|
return item['path']
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def _look_for_serial_port():
|
def _look_for_serial_port():
|
||||||
|
@ -70,8 +70,8 @@ def device_list( # pylint: disable=too-many-branches
|
|||||||
|
|
||||||
if key == "logical":
|
if key == "logical":
|
||||||
for item in value:
|
for item in value:
|
||||||
click.secho(item['device'], fg="cyan")
|
click.secho(item['path'], fg="cyan")
|
||||||
click.echo("-" * len(item['device']))
|
click.echo("-" * len(item['path']))
|
||||||
click.echo("Name: %s" % item['name'])
|
click.echo("Name: %s" % item['name'])
|
||||||
click.echo("")
|
click.echo("")
|
||||||
|
|
||||||
|
@ -458,7 +458,7 @@ def get_logical_devices():
|
|||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
items.append({
|
items.append({
|
||||||
"device": match.group(1) + "\\",
|
"path": match.group(1) + "\\",
|
||||||
"name": match.group(2)
|
"name": match.group(2)
|
||||||
})
|
})
|
||||||
return items
|
return items
|
||||||
@ -467,7 +467,7 @@ def get_logical_devices():
|
|||||||
# try "fsutil"
|
# try "fsutil"
|
||||||
result = exec_command(["fsutil", "fsinfo", "drives"]).get("out", "")
|
result = exec_command(["fsutil", "fsinfo", "drives"]).get("out", "")
|
||||||
for device in re.findall(r"[A-Z]:\\", result):
|
for device in re.findall(r"[A-Z]:\\", result):
|
||||||
items.append({"device": device, "name": None})
|
items.append({"path": device, "name": None})
|
||||||
return items
|
return items
|
||||||
else:
|
else:
|
||||||
result = exec_command(["df"]).get("out")
|
result = exec_command(["df"]).get("out")
|
||||||
@ -477,7 +477,7 @@ def get_logical_devices():
|
|||||||
if not match:
|
if not match:
|
||||||
continue
|
continue
|
||||||
items.append({
|
items.append({
|
||||||
"device": match.group(1),
|
"path": match.group(1),
|
||||||
"name": basename(match.group(1))
|
"name": basename(match.group(1))
|
||||||
})
|
})
|
||||||
return items
|
return items
|
||||||
@ -486,7 +486,7 @@ def get_logical_devices():
|
|||||||
### Backward compatibility for PIO Core <3.5
|
### Backward compatibility for PIO Core <3.5
|
||||||
get_serialports = get_serial_ports
|
get_serialports = get_serial_ports
|
||||||
get_logicaldisks = lambda: [{
|
get_logicaldisks = lambda: [{
|
||||||
"disk": d['device'],
|
"disk": d['path'],
|
||||||
"name": d['name']
|
"name": d['name']
|
||||||
} for d in get_logical_devices()]
|
} for d in get_logical_devices()]
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user