Support macOS in automatic deployment

This commit is contained in:
Michal Moskal 2016-06-23 23:55:36 -07:00
parent 2629192bdb
commit 8edd8ac73a

View File

@ -6,6 +6,8 @@ import * as child_process from "child_process";
let writeFileAsync: any = Promise.promisify(fs.writeFile)
let execAsync: (cmd: string, options?: { cwd?: string }) => Promise<Buffer> = Promise.promisify(child_process.exec)
let readDirAsync = Promise.promisify(fs.readdir)
export function deployCoreAsync(res: ts.pxt.CompileResult) {
return getBitDrivesAsync()
@ -37,6 +39,10 @@ function getBitDrivesAsync(): Promise<string[]> {
})
return res
})
}
else if (process.platform == "darwin") {
return readDirAsync("/Volumes")
.then(lst => lst.filter(s => /MICROBIT/.test(s)).map(s => "/Volumes/" + s + "/"))
} else {
return Promise.resolve([])
}