修复linux平台文件对比BUG

This commit is contained in:
gb 2023-02-03 12:01:25 +08:00
parent d6c44d550d
commit e8a6bf5e61
1 changed files with 9 additions and 4 deletions

View File

@ -9,7 +9,7 @@
#else #else
#include <string.h> // for strcasecmp #include <string.h> // for strcasecmp
#define PATH_SEPERATOR "/" #define PATH_SEPERATOR "/"
#define THIS_MODULE_NAME "lang.so" #define THIS_MODULE_NAME "liblang.so"
#endif #endif
#include <string> #include <string>
@ -281,6 +281,7 @@ class lang_mgr
cur_id = get_cur_code_page_id(); cur_id = get_cur_code_page_id();
if (parse_pak_digest((uint8_t*)&cont[0], ms, (int*)&id)) if (parse_pak_digest((uint8_t*)&cont[0], ms, (int*)&id))
{ {
ret = true;
if (id == DEFAULT_CODE_PAGE) if (id == DEFAULT_CODE_PAGE)
cp_default_ = ms; cp_default_ = ms;
else else
@ -367,7 +368,7 @@ class lang_mgr
char path[512] = { 0 }; char path[512] = { 0 };
int len = readlink(lnk, path, sizeof(path) - 1); int len = readlink(lnk, path, sizeof(path) - 1);
return path; return len > 0 ? path : lnk;
} }
static bool found_module(const char* file, void* param) static bool found_module(const char* file, void* param)
{ {
@ -442,8 +443,8 @@ class lang_mgr
} }
else else
{ {
char* ext = strrchr(ent->d_name, '.'); //char* ext = strrchr(ent->d_name, '.');
if (ext && strcasecmp(ext, ".pak") == 0) //if (ext && strcasecmp(ext, ".pak") == 0)
{ {
std::string file(dir); std::string file(dir);
@ -463,6 +464,10 @@ class lang_mgr
} }
static bool found_language_pak(const char* file, void* obj) static bool found_language_pak(const char* file, void* obj)
{ {
#if !defined(_WIN32) && !defined(_WIN64)
const char* ext = strrchr(file, '.');
if (ext && strcasecmp(ext, ".pak") == 0)
#endif
((lang_mgr*)obj)->load_language_pak(file, true); ((lang_mgr*)obj)->load_language_pak(file, true);
return true; return true;