Merged changes from 0.76.2 tag.

This commit is contained in:
leo
2012-04-11 04:58:40 +00:00
parent fdc8f31643
commit 64361beeac
14 changed files with 251 additions and 44 deletions
+39
View File
@@ -7,6 +7,8 @@
#include <gtk/gtk.h>
#include <X11/keysym.h>
#include <sys/time.h>
#include <sys/types.h>
#include <dirent.h>
#include "opengl.h"
#include "gtkmisc.h"
#include "camera.h"
@@ -118,9 +120,46 @@ bool Sys_KeyDown(int Key)
return false;
}
void Sys_GetFileList(const char* Path, ObjArray<String>& FileList)
{
struct dirent* Entry;
char DirPath[LC_MAXPATH], FilePath[LC_MAXPATH];
strcpy(DirPath, Path);
int Length = strlen(DirPath);
if (DirPath[Length - 1] != '/')
strcat(DirPath, "/");
FileList.RemoveAll();
DIR* Dir = opendir(DirPath);
if (!Dir)
{
printf("Couldn't open directory.\n");
return;
}
while ((Entry = readdir(Dir)))
{
int Length;
if (Entry->d_type != DT_REG)
continue;
Length = strlen(Entry->d_name);
if (Length < 5)
continue;
if (strcmp(Entry->d_name + Length - 4, ".dat"))
continue;
sprintf(FilePath, "%s%s", DirPath, Entry->d_name);
FileList.Add(FilePath);
}
closedir(Dir);
}
// String
char* strupr(char* string)