summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--android/src/org/rockbox/RockboxService.java27
1 files changed, 25 insertions, 2 deletions
diff --git a/android/src/org/rockbox/RockboxService.java b/android/src/org/rockbox/RockboxService.java
index 20b8d0c806..fc496f4331 100644
--- a/android/src/org/rockbox/RockboxService.java
+++ b/android/src/org/rockbox/RockboxService.java
@@ -169,7 +169,11 @@ public class RockboxService extends Service
169 { 169 {
170 final int BUFFER = 8*1024; 170 final int BUFFER = 8*1024;
171 String rockboxDirPath = "/data/data/org.rockbox/app_rockbox/rockbox"; 171 String rockboxDirPath = "/data/data/org.rockbox/app_rockbox/rockbox";
172 String rockboxCreditsPath = "/data/data/org.rockbox/app_rockbox/rockbox/rocks/viewers";
173 String rockboxSdDirPath = "/sdcard/rockbox";
172 File rockboxDir = new File(rockboxDirPath); 174 File rockboxDir = new File(rockboxDirPath);
175 File rockboxSdDir = new File(rockboxSdDirPath);
176 File rockboxCreditsDir = new File(rockboxCreditsPath);
173 177
174 /* load library before unzipping which may take a while */ 178 /* load library before unzipping which may take a while */
175 synchronized (lock) { 179 synchronized (lock) {
@@ -184,7 +188,16 @@ public class RockboxService extends Service
184 */ 188 */
185 File libMisc = new File("/data/data/org.rockbox/lib/libmisc.so"); 189 File libMisc = new File("/data/data/org.rockbox/lib/libmisc.so");
186 /* use arbitrary file to determine whether extracting is needed */ 190 /* use arbitrary file to determine whether extracting is needed */
187 File arbitraryFile = new File(rockboxDir, "viewers.config"); 191 File arbitraryFile = new File(rockboxCreditsPath, "credits.rock");
192 File rockboxInfoFile = new File(rockboxSdDirPath, "rockbox-info.txt");
193 boolean extractToSd = false;
194 if(rockboxInfoFile.exists()) {
195 extractToSd = true;
196 LOG("extracting resources to SD card");
197 }
198 else {
199 LOG("extracting resources to internal memory");
200 }
188 if (!arbitraryFile.exists() || (libMisc.lastModified() > arbitraryFile.lastModified())) 201 if (!arbitraryFile.exists() || (libMisc.lastModified() > arbitraryFile.lastModified()))
189 { 202 {
190 try 203 try
@@ -202,7 +215,16 @@ public class RockboxService extends Service
202 /* strip off /.rockbox when extracting */ 215 /* strip off /.rockbox when extracting */
203 String fileName = entry.getName(); 216 String fileName = entry.getName();
204 int slashIndex = fileName.indexOf('/', 1); 217 int slashIndex = fileName.indexOf('/', 1);
205 file = new File(rockboxDirPath + fileName.substring(slashIndex)); 218 /* codecs are now stored as libs, only keep rocks on internal */
219 if(extractToSd == false
220 || fileName.substring(slashIndex).startsWith("/rocks"))
221 {
222 file = new File(rockboxDirPath + fileName.substring(slashIndex));
223 }
224 else
225 {
226 file = new File(rockboxSdDirPath + fileName.substring(slashIndex));
227 }
206 228
207 if (!entry.isDirectory()) 229 if (!entry.isDirectory())
208 { 230 {
@@ -230,6 +252,7 @@ public class RockboxService extends Service
230 resultReceiver.send(RESULT_LIB_LOAD_PROGRESS, progressData); 252 resultReceiver.send(RESULT_LIB_LOAD_PROGRESS, progressData);
231 } 253 }
232 } 254 }
255 arbitraryFile.setLastModified(libMisc.lastModified());
233 } catch(Exception e) { 256 } catch(Exception e) {
234 LOG("Exception when unzipping", e); 257 LOG("Exception when unzipping", e);
235 e.printStackTrace(); 258 e.printStackTrace();