mirror of
https://github.com/platformio/platformio-core.git
synced 2025-07-29 17:47:14 +02:00
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():
|
||||
msdlabels = ("mbed", "nucleo", "frdm", "microbit")
|
||||
for item in util.get_logical_devices():
|
||||
if item['device'].startswith("/net") or not _is_match_pattern(
|
||||
item['device']):
|
||||
if item['path'].startswith("/net") or not _is_match_pattern(
|
||||
item['path']):
|
||||
continue
|
||||
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]):
|
||||
return item['device']
|
||||
return item['path']
|
||||
if item['name'] \
|
||||
and any([l in item['name'].lower() for l in msdlabels]):
|
||||
return item['device']
|
||||
return item['path']
|
||||
return None
|
||||
|
||||
def _look_for_serial_port():
|
||||
|
@ -70,8 +70,8 @@ def device_list( # pylint: disable=too-many-branches
|
||||
|
||||
if key == "logical":
|
||||
for item in value:
|
||||
click.secho(item['device'], fg="cyan")
|
||||
click.echo("-" * len(item['device']))
|
||||
click.secho(item['path'], fg="cyan")
|
||||
click.echo("-" * len(item['path']))
|
||||
click.echo("Name: %s" % item['name'])
|
||||
click.echo("")
|
||||
|
||||
|
@ -458,7 +458,7 @@ def get_logical_devices():
|
||||
if not match:
|
||||
continue
|
||||
items.append({
|
||||
"device": match.group(1) + "\\",
|
||||
"path": match.group(1) + "\\",
|
||||
"name": match.group(2)
|
||||
})
|
||||
return items
|
||||
@ -467,7 +467,7 @@ def get_logical_devices():
|
||||
# try "fsutil"
|
||||
result = exec_command(["fsutil", "fsinfo", "drives"]).get("out", "")
|
||||
for device in re.findall(r"[A-Z]:\\", result):
|
||||
items.append({"device": device, "name": None})
|
||||
items.append({"path": device, "name": None})
|
||||
return items
|
||||
else:
|
||||
result = exec_command(["df"]).get("out")
|
||||
@ -477,7 +477,7 @@ def get_logical_devices():
|
||||
if not match:
|
||||
continue
|
||||
items.append({
|
||||
"device": match.group(1),
|
||||
"path": match.group(1),
|
||||
"name": basename(match.group(1))
|
||||
})
|
||||
return items
|
||||
@ -486,7 +486,7 @@ def get_logical_devices():
|
||||
### Backward compatibility for PIO Core <3.5
|
||||
get_serialports = get_serial_ports
|
||||
get_logicaldisks = lambda: [{
|
||||
"disk": d['device'],
|
||||
"disk": d['path'],
|
||||
"name": d['name']
|
||||
} for d in get_logical_devices()]
|
||||
|
||||
|
Reference in New Issue
Block a user