mirror of
https://github.com/ZDoom/gzdoom-gles.git
synced 2024-12-11 13:01:19 +00:00
- fixed I_FindAttr() to handle symlinks on POSIX platforms
This commit is contained in:
parent
3b89c2fd34
commit
8b5131eeaa
2 changed files with 13 additions and 4 deletions
|
@ -112,9 +112,10 @@ bool I_SetCursor(FTexture *);
|
||||||
struct findstate_t
|
struct findstate_t
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
int count;
|
FString path;
|
||||||
struct dirent **namelist;
|
struct dirent **namelist;
|
||||||
int current;
|
int current;
|
||||||
|
int count;
|
||||||
|
|
||||||
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
|
friend void *I_FindFirst(const char *filespec, findstate_t *fileinfo);
|
||||||
friend int I_FindNext(void *handle, findstate_t *fileinfo);
|
friend int I_FindNext(void *handle, findstate_t *fileinfo);
|
||||||
|
|
|
@ -19,14 +19,13 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
//
|
//
|
||||||
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <errno.h>
|
|
||||||
#include <fnmatch.h>
|
#include <fnmatch.h>
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
#include <AvailabilityMacros.h>
|
#include <AvailabilityMacros.h>
|
||||||
#endif // __APPLE__
|
#endif // __APPLE__
|
||||||
|
|
||||||
|
#include "cmdlib.h"
|
||||||
#include "d_protocol.h"
|
#include "d_protocol.h"
|
||||||
#include "i_system.h"
|
#include "i_system.h"
|
||||||
#include "gameconfigfile.h"
|
#include "gameconfigfile.h"
|
||||||
|
@ -90,6 +89,7 @@ void *I_FindFirst(const char *const filespec, findstate_t *const fileinfo)
|
||||||
{
|
{
|
||||||
pattern = slash + 1;
|
pattern = slash + 1;
|
||||||
dir = FString(filespec, slash - filespec + 1);
|
dir = FString(filespec, slash - filespec + 1);
|
||||||
|
fileinfo->path = dir;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -142,7 +142,15 @@ int I_FindClose(void *const handle)
|
||||||
int I_FindAttr(findstate_t *const fileinfo)
|
int I_FindAttr(findstate_t *const fileinfo)
|
||||||
{
|
{
|
||||||
dirent *const ent = fileinfo->namelist[fileinfo->current];
|
dirent *const ent = fileinfo->namelist[fileinfo->current];
|
||||||
return (ent->d_type & DT_DIR) ? FA_DIREC : 0;
|
const FString path = fileinfo->path + ent->d_name;
|
||||||
|
bool isdir;
|
||||||
|
|
||||||
|
if (DirEntryExists(path, &isdir))
|
||||||
|
{
|
||||||
|
return isdir ? FA_DIREC : 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue