better board name detection
This commit is contained in:
parent
09933b6a8d
commit
28ae4f4230
@ -28,11 +28,12 @@ export function deployCoreAsync(res: ts.pxt.CompileResult) {
|
||||
|
||||
function getBitDrivesAsync(): Promise<string[]> {
|
||||
if (process.platform == "win32") {
|
||||
let rx = new RegExp("^([A-Z]:).* " + pxt.appTarget.compile.deployDrives)
|
||||
return execAsync("wmic PATH Win32_LogicalDisk get DeviceID, VolumeName, FileSystem")
|
||||
.then(buf => {
|
||||
let res: string[] = []
|
||||
buf.toString("utf8").split(/\n/).forEach(ln => {
|
||||
let m = /^([A-Z]:).* MICROBIT/.exec(ln)
|
||||
let m = rx.exec(ln)
|
||||
if (m) {
|
||||
res.push(m[1] + "/")
|
||||
}
|
||||
@ -41,8 +42,9 @@ function getBitDrivesAsync(): Promise<string[]> {
|
||||
})
|
||||
}
|
||||
else if (process.platform == "darwin") {
|
||||
let rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||
return readDirAsync("/Volumes")
|
||||
.then(lst => lst.filter(s => /MICROBIT/.test(s)).map(s => "/Volumes/" + s + "/"))
|
||||
.then(lst => lst.filter(s => rx.test(s)).map(s => "/Volumes/" + s + "/"))
|
||||
} else {
|
||||
return Promise.resolve([])
|
||||
}
|
||||
|
@ -52,7 +52,7 @@
|
||||
"compile": {
|
||||
"isNative": false,
|
||||
"hasHex": true,
|
||||
"deployDrives": "^MICROBIT",
|
||||
"deployDrives": "(MICROBIT|MBED)",
|
||||
"driveName": "MICROBIT",
|
||||
"hexMimeType": "application/x-microbit-hex"
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user