forked from KolibriOS/kolibrios
85f85fa6d0
git-svn-id: svn://kolibrios.org@5548 a494cfbc-eb01-0410-851d-a64ba20cac60
54 lines
1.2 KiB
C
54 lines
1.2 KiB
C
int files_mas[2000];
|
|
dword buf;
|
|
|
|
|
|
void OpenDirectory(dword folder_path)
|
|
{
|
|
int cur;
|
|
char temp_filename[4096];
|
|
dword j, filesnum, end_pointer;
|
|
|
|
list.count = 0;
|
|
if (buf) free(buf);
|
|
if (GetDir(#buf, #filesnum, folder_path, DIRS_ONLYREAL)==0)
|
|
if (filesnum==0)
|
|
{
|
|
notify("'Error opening folder' -E");
|
|
}
|
|
|
|
for (j=0; j<filesnum; j++)
|
|
{
|
|
strcpy(#temp_filename, j*304 + buf+72);
|
|
end_pointer = #temp_filename+strlen(#temp_filename);
|
|
if (strcmpi(end_pointer-4,".mp3")!=0) continue;
|
|
cur = list.count;
|
|
files_mas[cur]=j;
|
|
list.count++;
|
|
}
|
|
SortByName(0, list.count-1);
|
|
}
|
|
|
|
void SortByName(int a, b)
|
|
{
|
|
int j, i = a;
|
|
if (a >= b) return;
|
|
for (j = a; j <= b; j++)
|
|
if (strcmp(files_mas[j]*304 + buf+72, files_mas[b]*304 + buf+72)<=0) { files_mas[i] >< files_mas[j]; i++;}
|
|
SortByName(a, i-2);
|
|
SortByName(i, b);
|
|
}
|
|
|
|
void SetOpenedFileFirst(dword in_name)
|
|
{
|
|
int i;
|
|
dword opened_filename = in_name + strrchr(in_name, '/');
|
|
for (i=0; i<list.count; i++)
|
|
{
|
|
if (strcmpi(opened_filename,files_mas[i]*304 + buf+72)==0) { files_mas[0]><files_mas[i]; return; }
|
|
}
|
|
}
|
|
|
|
dword GetCurrentItemName() {
|
|
return files_mas[list.current]*304 + buf+72;
|
|
}
|