mirror of
https://github.com/skogaby/butterfly.git
synced 2026-09-09 00:35:10 -05:00
Resolve the issue of the Python executable name on different platforms
This commit is contained in:
@@ -41,7 +41,9 @@ public class CardIdUtils {
|
||||
path = Paths.get(Main.class.getResource("/cardconv.py").toURI());
|
||||
}
|
||||
|
||||
final ProcessBuilder builder = new ProcessBuilder("python",
|
||||
// when running this under Windows, Python 3 still is called python.exe; Linux has python3 as an executable
|
||||
final String command = System.getProperty("os.name").toLowerCase().startsWith("windows") ? "python" : "python3";
|
||||
final ProcessBuilder builder = new ProcessBuilder(command,
|
||||
"-c",
|
||||
"import cardconv; print(cardconv.CardCipher.encode('" + id + "'));");
|
||||
builder.directory(path.getParent().toFile());
|
||||
|
||||
Reference in New Issue
Block a user