Subversion Repositories Kolibri OS

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. char temp_filename[4096],
  2.      work_folder[4096],
  3.      current_filename[256];
  4. int files_mas[2000];
  5. dword buf;
  6.  
  7.  
  8. void OpenDirectory(dword folder_path)
  9. {
  10.         int cur;
  11.         dword j, filesnum, end_pointer;
  12.  
  13.         list.count = 0;
  14.         //free(buf);
  15.         if (GetDir(#buf, #filesnum, folder_path, DIRS_ONLYREAL)==0)
  16.         if (filesnum==0)
  17.         {
  18.                 notify("'Error opening folder' -E");
  19.         }
  20.        
  21.         for (j=0; j<filesnum; j++)
  22.         {
  23.                 strcpy(#temp_filename, j*304 + buf+72);
  24.                 end_pointer = #temp_filename+strlen(#temp_filename);
  25.                 if (strcmpi(end_pointer-4,".mp3")!=0) continue;
  26.                 cur = list.count;
  27.                 files_mas[cur]=j;
  28.                 list.count++;
  29.         }
  30.         SortByName(0, list.count-1);
  31.         SetOpenedFileFirst();
  32. }
  33.  
  34. void SortByName(int a, b)
  35. {
  36.         int j, i = a;
  37.         if (a >= b) return;
  38.         for (j = a; j <= b; j++)
  39.                 if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j];   i++;}
  40.         SortByName(a, i-2);
  41.         SortByName(i, b);
  42. }
  43.  
  44. void SetOpenedFileFirst()
  45. {
  46.         int i;
  47.         dword opened_filename = #param + strrchr(#param, '/');
  48.         for (i=0; i<list.count; i++)
  49.         {
  50.                 if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
  51.         }
  52. }
  53.  
  54. dword GetCurrentItemName() {
  55.         return files_mas[list.current]*304 + buf+72;
  56. }
  57.