[vlc-devel] [PATCH] Small refactoring in AndroidDevices.getStorageDirectories()
Andrey Khalyavin
halyavin at google.com
Tue Nov 25 14:24:51 CET 2014
This patch makes code nicer and getStorageDirectories() does not
return null on exception any more.
With best regards,
Andrey Khalyavin
>From 1fb0f9d19fbefbf30e8019a47a3b241c5fe1f6b0 Mon Sep 17 00:00:00 2001
From: Andrey Khalyavin <halyavin at google.com>
Date: Tue, 25 Nov 2014 15:31:43 +0300
Subject: [PATCH] Do not return null on exception in
AndroidDevices.getStorageDirectories().
---
vlc-android/src/org/videolan/vlc/util/AndroidDevices.java | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
index d71f55f..ae8f473 100644
--- a/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
+++ b/vlc-android/src/org/videolan/vlc/util/AndroidDevices.java
@@ -88,7 +88,6 @@ public class AndroidDevices {
}
public static String[] getStorageDirectories() {
- String[] dirs = null;
BufferedReader bufReader = null;
ArrayList<String> list = new ArrayList<String>();
list.add(Environment.getExternalStorageDirectory().getPath());
@@ -127,11 +126,6 @@ public class AndroidDevices {
if (Strings.StartsWith(deviceWL, device) &&
(typeWL.contains(type) || Strings.StartsWith(mountWL, mountpoint)))
list.add(mountpoint);
}
-
- dirs = new String[list.size()];
- for (int i = 0; i < list.size(); i++) {
- dirs[i] = list.get(i);
- }
}
catch (FileNotFoundException e) {}
catch (IOException e) {}
@@ -143,7 +137,7 @@ public class AndroidDevices {
catch (IOException e) {}
}
}
- return dirs;
+ return list.toArray(new String[list.size()]);
}
public static String[] getMediaDirectories() {
--
2.1.0.rc2.206.gedb03e5
More information about the vlc-devel
mailing list