diff options
author | Soo-Hwan Na <whiteshell2544@naver.com> | 2024-02-27 09:55:26 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-27 09:55:26 +0900 |
commit | f28792e5c73f8c9d6bfa8651b2104bd0917ce98e (patch) | |
tree | 23bcd80db89980bd841921054ce5bc1590f17dc5 /src | |
parent | 159895fbd32f10b3f955c8f0b3ef7326e784cfe9 (diff) |
tgbot-cpp: InputFile: Use std::fs for getting filename
- A platform independent way, to fix Windows-style directory delimiters
Diffstat (limited to 'src')
-rw-r--r-- | src/types/InputFile.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/types/InputFile.cpp b/src/types/InputFile.cpp index c74c73e..c4d804d 100644 --- a/src/types/InputFile.cpp +++ b/src/types/InputFile.cpp @@ -1,7 +1,7 @@ #include "tgbot/types/InputFile.h" -#include "tgbot/tools/StringTools.h" #include "tgbot/tools/FileTools.h" +#include <filesystem> #include <memory> #include <string> @@ -13,7 +13,7 @@ InputFile::Ptr InputFile::fromFile(const string& filePath, const string& mimeTyp auto result(make_shared<InputFile>()); result->data = FileTools::read(filePath); result->mimeType = mimeType; - result->fileName = StringTools::split(filePath, '/').back(); + result->fileName = std::filesystem::path(filePath).filename().string(); return result; } |