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[]> {
|
function getBitDrivesAsync(): Promise<string[]> {
|
||||||
if (process.platform == "win32") {
|
if (process.platform == "win32") {
|
||||||
|
let rx = new RegExp("^([A-Z]:).* " + pxt.appTarget.compile.deployDrives)
|
||||||
return execAsync("wmic PATH Win32_LogicalDisk get DeviceID, VolumeName, FileSystem")
|
return execAsync("wmic PATH Win32_LogicalDisk get DeviceID, VolumeName, FileSystem")
|
||||||
.then(buf => {
|
.then(buf => {
|
||||||
let res: string[] = []
|
let res: string[] = []
|
||||||
buf.toString("utf8").split(/\n/).forEach(ln => {
|
buf.toString("utf8").split(/\n/).forEach(ln => {
|
||||||
let m = /^([A-Z]:).* MICROBIT/.exec(ln)
|
let m = rx.exec(ln)
|
||||||
if (m) {
|
if (m) {
|
||||||
res.push(m[1] + "/")
|
res.push(m[1] + "/")
|
||||||
}
|
}
|
||||||
@ -41,8 +42,9 @@ function getBitDrivesAsync(): Promise<string[]> {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else if (process.platform == "darwin") {
|
else if (process.platform == "darwin") {
|
||||||
|
let rx = new RegExp(pxt.appTarget.compile.deployDrives)
|
||||||
return readDirAsync("/Volumes")
|
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 {
|
} else {
|
||||||
return Promise.resolve([])
|
return Promise.resolve([])
|
||||||
}
|
}
|
||||||
|
@ -52,7 +52,7 @@
|
|||||||
"compile": {
|
"compile": {
|
||||||
"isNative": false,
|
"isNative": false,
|
||||||
"hasHex": true,
|
"hasHex": true,
|
||||||
"deployDrives": "^MICROBIT",
|
"deployDrives": "(MICROBIT|MBED)",
|
||||||
"driveName": "MICROBIT",
|
"driveName": "MICROBIT",
|
||||||
"hexMimeType": "application/x-microbit-hex"
|
"hexMimeType": "application/x-microbit-hex"
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user