[Android] libvlc: fix PathToURI

Thomas Guillem git at videolan.org
Thu May 28 15:34:10 CEST 2015


vlc-ports/android | branch: master | Thomas Guillem <thomas at gllm.fr> | Thu May 28 15:27:58 2015 +0200| [6d20e268311befdb4dfeab7aa378e986368307d0] | committer: Thomas Guillem

libvlc: fix PathToURI

> http://git.videolan.org/gitweb.cgi/vlc-ports/android.git/?a=commit;h=6d20e268311befdb4dfeab7aa378e986368307d0
---

 libvlc/src/org/videolan/libvlc/util/AndroidUtil.java |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java b/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
index 91935d1..c7a7dd3 100644
--- a/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
+++ b/libvlc/src/org/videolan/libvlc/util/AndroidUtil.java
@@ -85,8 +85,10 @@ public class AndroidUtil {
         if (path == null) {
             throw new NullPointerException("Cannot convert null path!");
         }
-
-        File f = new File(path);
-        return f.toURI().toString();
+        Uri uri = Uri.parse(path);
+        if (uri.getScheme() == null)
+            return Uri.parse("file://" + path).toString();
+        else
+            return uri.toString();
     }
 }
\ No newline at end of file



More information about the Android mailing list