[vlc-devel] [PATCH] Small refactoring in AndroidDevices.getStorageDirectories()

Geoffrey Métais geoffrey.metais at gmail.com
Tue Nov 25 17:02:08 CET 2014


Actually I did it the opposite way.

This method was used with Arrays.asList() conversion

So I changed it to return the ArrayList directly and avoid two-ways
conversion.

Check the android mailing list.

Anyway thanks for checking this part of code, it was really ugly.

On Tue, Nov 25, 2014 at 3:20 PM, Andrey Khalyavin <halyavin at google.com>
wrote:

> Could you commit the patch for me (I am not a contributor)?
>
> 2014-11-25 16:41 GMT+03:00 Geoffrey Métais <geoffrey.metais at gmail.com>:
> > LGTM.
> >
> > But you should have mailed it to android at videolan.org instead ;)
> I didn't found this information on the wiki. Will take into account
> the next time.
>
> With best regards,
> Andrey Khalyavin
> >
> > 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
> >
> >
> >
> > _______________________________________________
> > vlc-devel mailing list
> > To unsubscribe or modify your subscription options:
> > https://mailman.videolan.org/listinfo/vlc-devel
> >
> _______________________________________________
> 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/65dbbc8a/attachment.html>


More information about the vlc-devel mailing list