mirror of
https://github.com/peterosterlund2/droidfish.git
synced 2025-12-19 04:02:23 +01:00
DroidFish: Implemented chmod using JNI. More efficient than starting a process.
This commit is contained in:
@@ -43,4 +43,7 @@ public class EngineUtil {
|
||||
abi = "armeabi"; // Unknown ABI, assume original ARM
|
||||
return "stockfish-" + abi;
|
||||
}
|
||||
|
||||
/** Executes chmod 744 exePath. */
|
||||
final static native boolean chmod(String exePath);
|
||||
}
|
||||
|
||||
@@ -240,12 +240,7 @@ public class ExternalEngine extends UCIEngineBase {
|
||||
}
|
||||
|
||||
private final void chmod(String exePath) throws IOException {
|
||||
Process proc = Runtime.getRuntime().exec(new String[]{"chmod", "744", exePath});
|
||||
try {
|
||||
proc.waitFor();
|
||||
} catch (InterruptedException e) {
|
||||
proc.destroy();
|
||||
if (!EngineUtil.chmod(exePath))
|
||||
throw new IOException("chmod failed");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user