mp3 plugin error

Message ID er6r8g$igs$2@video.local.muempf.de
State New
Headers

Commit Message

Stefan Huelswitt Feb. 17, 2007, 12:08 p.m. UTC
  On 26 Jan 2007 Marco Skambraks <marco@ammec.de> wrote:
> On Thu, 25 Jan 2007, Halim Sahin wrote:
>> 
>> The plugin remembers the last played directory but does not check if the 
>> dir is
>> available before loading it.
>> 
>> A fix can be possible in LoadDir function????
> 
> I made a dirty hack and it looks OK but not very fast and not nice
> menu.c - LoadDir line 141:

You're right. Thanks for reporting.

I adapted the patch as attached.

Regards.
  

Patch

--- menu.c
+++ menu.c
@@ -107,8 +107,7 @@ 
   excl=Excl;
 
   SetSource(Source); 
-  LoadDir(currentdir);
-  SetButtons();
+  NewDir(currentdir);
 }
 
 cMenuBrowse::~cMenuBrowse()
@@ -157,7 +156,12 @@ 
 bool cMenuBrowse::NewDir(const char *dir)
 {
   char *ncur=dir ? strdup(dir):0;
-  if(LoadDir(ncur)) {
+  bool r=LoadDir(ncur);
+  if(!r && ncur) {
+    free(ncur); ncur=0;
+    r=LoadDir(ncur);
+    }
+  if(r) {
     free(currentdir); currentdir=ncur;
 
     cFileObj *item=CurrentItem();