[Android] util to convert from real to emulated FS path
Geoffrey Métais
git at videolan.org
Thu Apr 7 15:09:37 CEST 2016
vlc-android | branch: master | Geoffrey Métais <geoffrey.metais at gmail.com> | Thu Apr 7 13:56:22 2016 +0200| [bdb9aa745f2a98958e50e5c70221570e07516cd6] | committer: Geoffrey Métais
util to convert from real to emulated FS path
> https://code.videolan.org/videolan/vlc-android/commit/bdb9aa745f2a98958e50e5c70221570e07516cd6
---
vlc-android/src/org/videolan/vlc/util/FileUtils.java | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/vlc-android/src/org/videolan/vlc/util/FileUtils.java b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
index e233d11..78b7655 100644
--- a/vlc-android/src/org/videolan/vlc/util/FileUtils.java
+++ b/vlc-android/src/org/videolan/vlc/util/FileUtils.java
@@ -75,6 +75,17 @@ public class FileUtils {
return parentPath;
}
+ /*
+ * Convert file:// uri from real path to emulated FS path.
+ */
+ public static Uri convertLocalUri(Uri uri) {
+ if (!TextUtils.equals(uri.getScheme(), "file") || !uri.getPath().startsWith("/sdcard"))
+ return uri;
+ String path = uri.getPath();
+ path = path.replace("/sdcard", AndroidDevices.EXTERNAL_PUBLIC_DIRECTORY);
+ return Uri.parse("file://"+path);
+ }
+
public static String getPathFromURI(Uri contentUri) {
Cursor cursor = null;
try {
More information about the Android
mailing list