[Android] Copy lua folder from assets to device

Geoffrey Métais git at videolan.org
Fri Feb 5 16:13:12 CET 2016


vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Fri Feb  5 15:50:37 2016 +0100| [663a02d1607475daf0cfa0ff504e191c9b11d268] | committer: Geoffrey Métais

Copy lua folder from assets to device

TODO: change destination directory

> https://code.videolan.org/videolan/vlc-android/commit/663a02d1607475daf0cfa0ff504e191c9b11d268
---

 vlc-android/src/org/videolan/vlc/util/VLCInstance.java | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
index 5185b3e..2766bc6 100644
--- a/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
+++ b/vlc-android/src/org/videolan/vlc/util/VLCInstance.java
@@ -22,6 +22,7 @@ package org.videolan.vlc.util;
 
 import android.content.Context;
 import android.content.Intent;
+import android.content.res.AssetManager;
 import android.os.Build;
 import android.util.Log;
 
@@ -42,6 +43,16 @@ public class VLCInstance {
 
     private static LibVLC sLibVLC = null;
 
+    private static Runnable sCopyLua = new Runnable() {
+        @Override
+        public void run() {
+            String destinationFolder = AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY+
+                    "/Android/data/"+VLCApplication.getAppContext().getPackageName()+"/lua";
+            AssetManager am = VLCApplication.getAppResources().getAssets();
+            FileUtils.copyAssetFolder(am, "lua", destinationFolder);
+        }
+    };
+
     public static void linkCompatLib(Context context) {
         final File outDir = new File(context.getFilesDir(), "compat");
         if (!outDir.exists())
@@ -110,6 +121,8 @@ public class VLCInstance {
                     context.startActivity(i);
                 }
             });
+
+            VLCApplication.runBackground(sCopyLua);
         }
         return sLibVLC;
     }



More information about the Android mailing list