mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 19:29:09 +00:00
Fix some plString/plFileSystem issues for *nix.
This commit is contained in:
@ -341,21 +341,6 @@ void hsStrLower(char *s);
|
|||||||
char * hsFormatStr(const char * fmt, ...); // You are responsible for returned memory.
|
char * hsFormatStr(const char * fmt, ...); // You are responsible for returned memory.
|
||||||
char * hsFormatStrV(const char * fmt, va_list args); // You are responsible for returned memory.
|
char * hsFormatStrV(const char * fmt, va_list args); // You are responsible for returned memory.
|
||||||
|
|
||||||
// Use "correct" stricmp based on the selected compiler / library
|
|
||||||
#if _MSC_VER
|
|
||||||
# define stricmp _stricmp
|
|
||||||
# define strnicmp _strnicmp
|
|
||||||
# define wcsicmp _wcsicmp
|
|
||||||
# define wcsnicmp _wcsnicmp
|
|
||||||
# define strlwr _strlwr
|
|
||||||
#else
|
|
||||||
# define stricmp strcasecmp
|
|
||||||
# define strnicmp strncasecmp
|
|
||||||
# define wcsicmp wcscasecmp
|
|
||||||
# define wcsnicmp wcsncasecmp
|
|
||||||
# define strlwr hsStrLower
|
|
||||||
#endif
|
|
||||||
|
|
||||||
inline char* hsStrcpy(const char src[])
|
inline char* hsStrcpy(const char src[])
|
||||||
{
|
{
|
||||||
return hsStrcpy(nil, src);
|
return hsStrcpy(nil, src);
|
||||||
|
@ -380,15 +380,16 @@ std::vector<plFileName> plFileSystem::ListDir(const plFileName &path, const char
|
|||||||
|
|
||||||
struct dirent *de;
|
struct dirent *de;
|
||||||
while (de = readdir(dir)) {
|
while (de = readdir(dir)) {
|
||||||
if (plFileInfo(de->d_name).IsDirectory()) {
|
plFileName dir_name = plFileName::Join(path, de->d_name);
|
||||||
|
if (plFileInfo(dir_name).IsDirectory()) {
|
||||||
// Should also handle . and ..
|
// Should also handle . and ..
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern && pattern[0] && fnmatch(pattern, de->d_name))
|
if (pattern && pattern[0] && fnmatch(pattern, de->d_name, 0))
|
||||||
contents.push_back(plFileName::Join(path, de->d_name));
|
contents.push_back(dir_name);
|
||||||
else if (!pattern || !pattern[0])
|
else if (!pattern || !pattern[0])
|
||||||
contents.push_back(plFileName::Join(path, de->d_name));
|
contents.push_back(dir_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
closedir(dir);
|
closedir(dir);
|
||||||
@ -428,7 +429,7 @@ std::vector<plFileName> plFileSystem::ListSubdirs(const plFileName &path)
|
|||||||
if (plFileInfo(de->d_name).IsDirectory()) {
|
if (plFileInfo(de->d_name).IsDirectory()) {
|
||||||
plFileName name = de->d_name;
|
plFileName name = de->d_name;
|
||||||
if (name != "." && name != "..")
|
if (name != "." && name != "..")
|
||||||
contents.push_back(plFileName::Join(path, name);
|
contents.push_back(plFileName::Join(path, name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,8 +43,11 @@ You can contact Cyan Worlds, Inc. by email legal@cyan.com
|
|||||||
#ifndef plString_Defined
|
#ifndef plString_Defined
|
||||||
#define plString_Defined
|
#define plString_Defined
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <cstdint>
|
||||||
|
#include <cstddef>
|
||||||
|
#include <cstdarg>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
/** Single Unicode character code unit */
|
/** Single Unicode character code unit */
|
||||||
typedef unsigned int UniChar;
|
typedef unsigned int UniChar;
|
||||||
@ -53,6 +56,21 @@ typedef unsigned int UniChar;
|
|||||||
#define STRING_STACK_SIZE (256)
|
#define STRING_STACK_SIZE (256)
|
||||||
#define WHITESPACE_CHARS " \t\n\r"
|
#define WHITESPACE_CHARS " \t\n\r"
|
||||||
|
|
||||||
|
// Use "correct" stricmp based on the selected compiler / library
|
||||||
|
#if _MSC_VER
|
||||||
|
# define stricmp _stricmp
|
||||||
|
# define strnicmp _strnicmp
|
||||||
|
# define wcsicmp _wcsicmp
|
||||||
|
# define wcsnicmp _wcsnicmp
|
||||||
|
# define strlwr _strlwr
|
||||||
|
#else
|
||||||
|
# define stricmp strcasecmp
|
||||||
|
# define strnicmp strncasecmp
|
||||||
|
# define wcsicmp wcscasecmp
|
||||||
|
# define wcsnicmp wcsncasecmp
|
||||||
|
# define strlwr hsStrLower
|
||||||
|
#endif
|
||||||
|
|
||||||
/** Ref-counted string data buffer.
|
/** Ref-counted string data buffer.
|
||||||
* This is used to store actual string data in any (unchecked) encoding format,
|
* This is used to store actual string data in any (unchecked) encoding format,
|
||||||
* including both the internal UTF-8 data of plString itself as well as the
|
* including both the internal UTF-8 data of plString itself as well as the
|
||||||
|
Reference in New Issue
Block a user