mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-14 15:41:30 +00:00
[File] Fix File::Exists(file_name) to be resilient to Chinese characters (#4058)
* Update file.cpp * Update file.cpp * Update file.cpp * Update file.cpp * Update file.cpp * Update file.cpp * Update file.cpp * Update file.cpp * Final fix
This commit is contained in:
parent
78aa527bc7
commit
13994fb3e4
@ -38,21 +38,21 @@
|
|||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <sys/stat.h>
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
/**
|
|
||||||
* @param name
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
bool File::Exists(const std::string &name)
|
bool File::Exists(const std::string &name)
|
||||||
{
|
{
|
||||||
return fs::exists(fs::path{name});
|
struct stat sb{};
|
||||||
|
if (stat(name.c_str(), &sb) == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param directory_name
|
|
||||||
*/
|
|
||||||
void File::Makedir(const std::string &directory_name)
|
void File::Makedir(const std::string &directory_name)
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user