in src/main/kotlin/com/jetbrains/micropython/run/MicroUpload.kt [14:32]
fun getMicroUploadCommand(path: String, module: Module): List<String>? {
val facet = module.microPythonFacet ?: return null
val pythonPath = facet.pythonPath ?: return null
val devicePath = facet.getOrDetectDevicePathSynchronously() ?: return null
val file = StandardFileSystems.local().findFileByPath(path) ?: return null
val rootDir = getClosestRoot(file, module) ?: return null
val excludeRoots = ModuleRootManager.getInstance(module).excludeRoots
val excludes = excludeRoots
.asSequence()
.filter { VfsUtil.isAncestor(file, it, false) }
.map { VfsUtilCore.getRelativePath(it, rootDir) }
.filterNotNull()
.map { listOf("-X", it) }
.flatten()
.toList()
return listOf(pythonPath, "${MicroPythonFacet.scriptsPath}/microupload.py", "-C", rootDir.path) +
excludes +
listOf("-v", devicePath, path)
}