mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 16:51:29 +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 <filesystem>
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return
|
||||
*/
|
||||
|
||||
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)
|
||||
{
|
||||
try {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user