mirror of
https://github.com/ZDoom/Raze.git
synced 2024-11-15 08:51:24 +00:00
- removed the directory scan code from compat.cpp.
It is only used by the user map menus which I had to disable already and on top of that is blissfully incapable of dealing with Unicode.
This commit is contained in:
parent
f44d309558
commit
fca3c2f5b5
2 changed files with 0 additions and 205 deletions
|
@ -1190,28 +1190,6 @@ static inline void append_ext_UNSAFE(char *outbuf, const char *ext)
|
|||
Bstrcpy(p, ext);
|
||||
}
|
||||
|
||||
/* Begin dependence on compat.o object. */
|
||||
|
||||
|
||||
|
||||
#ifndef USE_PHYSFS
|
||||
////////// Directory enumeration //////////
|
||||
|
||||
struct Bdirent
|
||||
{
|
||||
char *name;
|
||||
uint32_t mode;
|
||||
uint32_t size;
|
||||
uint32_t mtime;
|
||||
uint16_t namlen;
|
||||
};
|
||||
|
||||
typedef void BDIR;
|
||||
|
||||
BDIR *Bopendir(const char *name);
|
||||
struct Bdirent *Breaddir(BDIR *dir);
|
||||
int32_t Bclosedir(BDIR *dir);
|
||||
#endif
|
||||
|
||||
|
||||
////////// Paths //////////
|
||||
|
@ -1219,18 +1197,12 @@ int32_t Bclosedir(BDIR *dir);
|
|||
char *Bgethomedir(void);
|
||||
|
||||
int32_t Bcorrectfilename(char *filename, int32_t removefn);
|
||||
int32_t Bcanonicalisefilename(char *filename, int32_t removefn);
|
||||
|
||||
char *Bgetsystemdrives(void);
|
||||
|
||||
|
||||
////////// String manipulation //////////
|
||||
|
||||
char *Bstrtoken(char *s, const char *delim, char **ptrptr, int chop);
|
||||
char *Bstrtolower(char *str);
|
||||
|
||||
#define Bwildmatch wildmatch
|
||||
|
||||
#ifdef _WIN32
|
||||
# ifdef _MSC_VER
|
||||
# define Bstrlwr _strlwr
|
||||
|
|
|
@ -147,141 +147,6 @@ int32_t Bcorrectfilename(char *filename, int32_t removefn)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef USE_PHYSFS
|
||||
typedef struct
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
intptr_t dir;
|
||||
struct _finddata_t fid;
|
||||
#else
|
||||
DIR *dir;
|
||||
#endif
|
||||
struct Bdirent info;
|
||||
int32_t status;
|
||||
char name[1];
|
||||
} BDIR_real;
|
||||
|
||||
BDIR *Bopendir(const char *name)
|
||||
{
|
||||
BDIR_real *dirr;
|
||||
#ifdef _MSC_VER
|
||||
char *t, *tt;
|
||||
t = (char *)Xmalloc(Bstrlen(name) + 1 + 4);
|
||||
#endif
|
||||
|
||||
dirr = (BDIR_real *)Xmalloc(sizeof(BDIR_real) + Bstrlen(name));
|
||||
|
||||
#ifdef _MSC_VER
|
||||
Bstrcpy(t, name);
|
||||
tt = t + Bstrlen(name) - 1;
|
||||
while (*tt == ' ' && tt > t) tt--;
|
||||
if (*tt != '/' && *tt != '\\')
|
||||
*(++tt) = '/';
|
||||
*(++tt) = '*';
|
||||
*(++tt) = '.';
|
||||
*(++tt) = '*';
|
||||
*(++tt) = 0;
|
||||
|
||||
dirr->dir = _findfirst(t, &dirr->fid);
|
||||
Xfree(t);
|
||||
if (dirr->dir == -1)
|
||||
{
|
||||
Xfree(dirr);
|
||||
return NULL;
|
||||
}
|
||||
#else
|
||||
dirr->dir = opendir(name);
|
||||
if (dirr->dir == NULL)
|
||||
{
|
||||
Xfree(dirr);
|
||||
return NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
dirr->status = 0;
|
||||
Bstrcpy(dirr->name, name);
|
||||
|
||||
return (BDIR *)dirr;
|
||||
}
|
||||
|
||||
struct Bdirent *Breaddir(BDIR *dir)
|
||||
{
|
||||
BDIR_real *dirr = (BDIR_real *)dir;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
if (dirr->status > 0)
|
||||
{
|
||||
if (_findnext(dirr->dir, &dirr->fid) != 0)
|
||||
{
|
||||
dirr->status = -1;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
dirr->info.namlen = Bstrlen(dirr->fid.name);
|
||||
dirr->info.name = dirr->fid.name;
|
||||
dirr->status++;
|
||||
#else
|
||||
struct dirent *de = readdir(dirr->dir);
|
||||
if (de == NULL)
|
||||
{
|
||||
dirr->status = -1;
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
dirr->status++;
|
||||
}
|
||||
dirr->info.namlen = Bstrlen(de->d_name);
|
||||
dirr->info.name = de->d_name;
|
||||
#endif
|
||||
dirr->info.mode = 0;
|
||||
dirr->info.size = 0;
|
||||
dirr->info.mtime = 0;
|
||||
|
||||
char *fn = (char *)Xmalloc(Bstrlen(dirr->name) + 1 + dirr->info.namlen + 1);
|
||||
Bsprintf(fn, "%s/%s", dirr->name, dirr->info.name);
|
||||
|
||||
#ifdef USE_PHYSFS
|
||||
PHYSFS_Stat st;
|
||||
if (PHYSFS_stat(fn, &st))
|
||||
{
|
||||
// dirr->info.mode = TODO;
|
||||
dirr->info.size = st.filesize;
|
||||
dirr->info.mtime = st.modtime;
|
||||
}
|
||||
#else
|
||||
struct Bstat st;
|
||||
if (!Bstat(fn, &st))
|
||||
{
|
||||
dirr->info.mode = st.st_mode;
|
||||
dirr->info.size = st.st_size;
|
||||
dirr->info.mtime = st.st_mtime;
|
||||
}
|
||||
#endif
|
||||
|
||||
Xfree(fn);
|
||||
|
||||
return &dirr->info;
|
||||
}
|
||||
|
||||
int32_t Bclosedir(BDIR *dir)
|
||||
{
|
||||
BDIR_real *dirr = (BDIR_real *)dir;
|
||||
|
||||
#ifdef _MSC_VER
|
||||
_findclose(dirr->dir);
|
||||
#else
|
||||
closedir(dirr->dir);
|
||||
#endif
|
||||
Xfree(dirr);
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
char *Bstrtoken(char *s, const char *delim, char **ptrptr, int chop)
|
||||
{
|
||||
if (!ptrptr)
|
||||
|
@ -337,48 +202,6 @@ char *Bstrtolower(char *str)
|
|||
return str;
|
||||
}
|
||||
|
||||
|
||||
//Brute-force case-insensitive, slash-insensitive, * and ? wildcard matcher
|
||||
//Returns: 1:matches, 0:doesn't match
|
||||
#ifndef WITHKPLIB
|
||||
extern char toupperlookup[256];
|
||||
|
||||
static int32_t wildmatch(const char *match, const char *wild)
|
||||
{
|
||||
do
|
||||
{
|
||||
if (*match && (toupperlookup[*wild] == toupperlookup[*match] || *wild == '?'))
|
||||
{
|
||||
wild++, match++;
|
||||
continue;
|
||||
}
|
||||
else if ((*match|*wild) == '\0')
|
||||
return 1;
|
||||
else if (*wild == '*')
|
||||
{
|
||||
do { wild++; } while (*wild == '*');
|
||||
do
|
||||
{
|
||||
if (*wild == '\0')
|
||||
return 1;
|
||||
while (*match && toupperlookup[*match] != toupperlookup[*wild]) match++;
|
||||
if (*match && *(match+1) && toupperlookup[*(match+1)] != toupperlookup[*(wild+1)])
|
||||
{
|
||||
match++;
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
while (1);
|
||||
if (toupperlookup[*match] == toupperlookup[*wild])
|
||||
continue;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
while (1);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if !defined(_WIN32)
|
||||
char *Bstrlwr(char *s)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue