Convert some code to work on more than only Linux and Windows (BSD, MacOS), fix script compile script not compiling due to French characters in code

This commit is contained in:
dginovker committed 2023-09-25 01:15:25 +09:00
1 parent b328e869f1
commit e650911d80
4 files changed
+11 -8

No files matched your search

+2 -2
View File
@@ -27,7 +27,7 @@
<delete file="${jar}"/>
<delete dir="${build}"/>
<mkdir dir="${build}"/>
<javac srcdir="${clientsrc}" destdir="${build}" debug="on" includeantruntime="false" target="${javac.target}"
<javac srcdir="${clientsrc}" destdir="${build}" debug="on" includeantruntime="false" target="${javac.target}" encoding="UTF-8"
source="${javac.source}" classpathref="compile.path">
<compilerarg line="-Xlint:unchecked"/>
</javac>
@@ -48,7 +48,7 @@
</not>
</condition>
</fail>
<javac srcdir="${scriptsrc}" destdir="${scripts}" debug="on" includeantruntime="false" target="${javac.target}"
<javac srcdir="${scriptsrc}" destdir="${scripts}" debug="on" includeantruntime="false" target="${javac.target}" encoding="UTF-8"
source="${javac.source}" classpathref="compile.path">
<compilerarg line="-Xlint:unchecked -Xlint:deprecation"/>
</javac>
@@ -171,10 +171,13 @@ public final class ScriptFrame extends Frame {
compileScriptsButton.addActionListener(e -> {
try {
final ProcessBuilder pb = new ProcessBuilder("cmd", "/c", "compile_scripts.cmd");
// If we're on Linux, use bash instead of cmd
if (System.getProperty("os.name").toLowerCase().contains("linux")) {
pb.command("bash", "-c", "chmod +x compile_scripts-linux.sh && ./compile_scripts-linux.sh");
}
// If we're on anything with sh, use the shell script instead
String os = System.getProperty("os.name").toLowerCase();
// Check if the OS is Unix-like (Linux, Mac, BSD, etc.)
if (os.contains("linux") || os.contains("mac") || os.contains("unix") || os.contains("bsd")) {
pb.command("sh", "-c", "chmod +x compile_scripts-linux.sh && ./compile_scripts-linux.sh");
}
// execute
final Process p = pb.start();
// get both the output and the error stream
+1 -1
View File
@@ -1,3 +1,3 @@
#!/bin/bash
#!/bin/sh
./apache-ant-1.10.12/bin/ant -f build.xml compile-all
Regular → Executable
+1 -1
View File
@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
# If there's not bot.jar in the folder, first call ./compile_all_linux.sh
if [ ! -f bot.jar ]; then