- Applied patch for fixing directory reading on Linux.

SVN r1628 (trunk)
This commit is contained in:
Christoph Oelckers 2009-06-01 06:43:32 +00:00
parent 91e0f4d11d
commit 14cdab7e39
2 changed files with 6 additions and 3 deletions

View file

@ -208,7 +208,9 @@ int FDirectory::AddDirectory(const char *dirpath)
int FDirectory::AddDirectory(const char *dirpath) int FDirectory::AddDirectory(const char *dirpath)
{ {
char *argv [2] = {dirpath, NULL }; char *argv [2] = {NULL, NULL };
argv[0] = new char[strlen(dirpath)+1];
strcpy(argv[0], dirpath);
FTS *fts; FTS *fts;
FTSENT *ent; FTSENT *ent;
int count = 0; int count = 0;
@ -216,7 +218,7 @@ int FDirectory::AddDirectory(const char *dirpath)
fts = fts_open(argv, FTS_LOGICAL, NULL); fts = fts_open(argv, FTS_LOGICAL, NULL);
if (fts == NULL) if (fts == NULL)
{ {
Printf "Failed to start directory traversal: %s\n", strerror(errno)); Printf("Failed to start directory traversal: %s\n", strerror(errno));
return NULL; return NULL;
} }
while ((ent = fts_read(fts)) != NULL) while ((ent = fts_read(fts)) != NULL)
@ -240,6 +242,7 @@ int FDirectory::AddDirectory(const char *dirpath)
count++; count++;
} }
fts_close(fts); fts_close(fts);
delete[] argv[0];
return count; return count;
} }
#endif #endif

View file

@ -61,7 +61,7 @@ private:
public: public:
static FResourceFile *OpenResourceFile(const char *filename, FileReader *file, bool quiet = false); static FResourceFile *OpenResourceFile(const char *filename, FileReader *file, bool quiet = false);
static FResourceFile *FResourceFile::OpenDirectory(const char *filename); static FResourceFile *OpenDirectory(const char *filename);
virtual ~FResourceFile(); virtual ~FResourceFile();
FileReader *GetReader() const { return Reader; } FileReader *GetReader() const { return Reader; }
DWORD LumpCount() const { return NumLumps; } DWORD LumpCount() const { return NumLumps; }