mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-02 00:17:02 +00:00
fix dirname() implementation of Windows in lottieloader.cpp, and fix basename() implementation by using strrchr() and not strchr()
This commit is contained in:
parent
71538bac3a
commit
ae933c37af
@ -110,11 +110,11 @@ public:
|
||||
|
||||
baseName = absoloutePath;
|
||||
#ifdef _WIN32
|
||||
char *base = strchr(baseName.data(), '/');
|
||||
char *base = strrchr(baseName.data(), '/');
|
||||
if (base)
|
||||
{
|
||||
base++;
|
||||
base = strchr(baseName.data(), '\\');
|
||||
base = strrchr(baseName.data(), '\\');
|
||||
if (base) base++;
|
||||
else return 1;
|
||||
}
|
||||
|
@ -71,6 +71,9 @@ public:
|
||||
static std::string dirname(const std::string &path)
|
||||
{
|
||||
const char *ptr = strrchr(path.c_str(), '/');
|
||||
#ifdef _WIN32
|
||||
if (ptr) ptr = strrchr(ptr + 1, '\\');
|
||||
#endif
|
||||
int len = int(ptr + 1 - path.c_str()); // +1 to include '/'
|
||||
return std::string(path, 0, len);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user