[vlc-devel] [PATCH] Small refactoring in AndroidDevices.getStorageDirectories()
Geoffrey Métais
geoffrey.metais at gmail.com
Tue Nov 25 14:41:02 CET 2014
LGTM.
But you should have mailed it to android at videolan.org instead ;)
On Tue, Nov 25, 2014 at 2:24 PM, Andrey Khalyavin <halyavin at google.com>
wrote:
> 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
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.videolan.org/pipermail/vlc-devel/attachments/20141125/d255d5be/attachment.html>
More information about the vlc-devel
mailing list