|
27 | 27 | import android.content.DialogInterface.OnCancelListener;
|
28 | 28 | import android.content.DialogInterface.OnClickListener;
|
29 | 29 | import android.os.AsyncTask;
|
30 |
| -import android.os.Build; |
31 | 30 | import android.util.Log;
|
32 | 31 | import android.util.Xml;
|
33 | 32 | import android.widget.Toast;
|
|
39 | 38 | * Class to manage UCI chess engines.
|
40 | 39 | */
|
41 | 40 | public class EngineManager {
|
| 41 | + public static final String INTERNAL_ENGINE_FILE_NAME = "libstockfish.so"; |
42 | 42 | private static final String ENGINE_DATA_FILE = "engines.xml";
|
43 | 43 | private static final String INTERNAL_ENGINE_NAME = "Stockfish 5";
|
44 | 44 | private static EngineConfig defaultEngine;
|
@@ -87,8 +87,9 @@ public interface EngineChangeListener {
|
87 | 87 | public EngineManager(Context context) {
|
88 | 88 | this.context = context;
|
89 | 89 | // Establish the default engine
|
90 |
| - defaultEngine = new EngineConfig(INTERNAL_ENGINE_NAME, context |
91 |
| - .getFilesDir().getPath() + getInternalEngineFileName(), null, 0); |
| 90 | + defaultEngine = new EngineConfig(INTERNAL_ENGINE_NAME, |
| 91 | + new File(context.getFilesDir(), INTERNAL_ENGINE_FILE_NAME) |
| 92 | + .getAbsolutePath(), null, 0); |
92 | 93 | }
|
93 | 94 |
|
94 | 95 | public String getFilesDir() {
|
@@ -138,17 +139,6 @@ public EngineConfig getCurrentEngine() {
|
138 | 139 | return getDefaultEngine();
|
139 | 140 | }
|
140 | 141 |
|
141 |
| - public static String getInternalEngineFileName() { |
142 |
| - final String engineFileName; |
143 |
| - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
144 |
| - // use the position independent executable (PIE) |
145 |
| - engineFileName = "libstockfish.so"; |
146 |
| - } else { |
147 |
| - engineFileName = "libstockfish-nopie.so"; |
148 |
| - } |
149 |
| - return engineFileName; |
150 |
| - } |
151 |
| - |
152 | 142 | /**
|
153 | 143 | * Convenience method to get the name of the current engine.
|
154 | 144 | *
|
|
0 commit comments