Skip to content
This repository was archived by the owner on Oct 18, 2024. It is now read-only.

Commit b371fb7

Browse files
committed
build(termux-bootstrap): escape backslashes in paths when writing termux-bootstrap.S on Windows
1 parent d1fa239 commit b371fb7

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

build-logic/ide/src/main/java/com/itsaky/androidide/plugins/TerminalBootstrapPackagesPlugin.kt

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ package com.itsaky.androidide.plugins
2020
import com.itsaky.androidide.plugins.util.DownloadUtils
2121
import org.gradle.api.Plugin
2222
import org.gradle.api.Project
23+
import org.gradle.internal.os.OperatingSystem
2324
import java.io.File
2425

2526
/**
@@ -74,11 +75,11 @@ class TerminalBootstrapPackagesPlugin : Plugin<Project> {
7475
.section .rodata
7576
blob:
7677
#if defined __aarch64__
77-
.incbin "${files["aarch64"]!!.absolutePath}"
78+
.incbin "${escapePathOnWindows(files["aarch64"]!!.absolutePath)}"
7879
#elif defined __arm__
79-
.incbin "${files["arm"]!!.absolutePath}"
80+
.incbin "${escapePathOnWindows(files["arm"]!!.absolutePath)}"
8081
#elif defined __x86_64__
81-
.incbin "${files["x86_64"]!!.absolutePath}"
82+
.incbin "${escapePathOnWindows(files["x86_64"]!!.absolutePath)}"
8283
#else
8384
# error Unsupported arch
8485
#endif
@@ -90,4 +91,13 @@ class TerminalBootstrapPackagesPlugin : Plugin<Project> {
9091
)
9192
}
9293
}
94+
95+
private fun escapePathOnWindows(path: String): String {
96+
if (OperatingSystem.current().isWindows) {
97+
// escape backslashes when building on Windows
98+
return path.replace("\\", "\\\\")
99+
}
100+
101+
return path
102+
}
93103
}

0 commit comments

Comments
 (0)