diff options
author | Oleg Morozenkov <m@oleg.rocks> | 2024-03-04 01:32:07 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-04 01:32:07 +0300 |
commit | f7c17f91c64c34f55381f0117b9d8cd8ac55b423 (patch) | |
tree | 9a470baf7a80df8e5575297b3d34a0b8eeb6d4b0 /src | |
parent | f1c2dbad1c9674f82e61b7cf76cdc618a2dba852 (diff) | |
parent | a92beb1d03d9df51667207b2f529a2a4a39b0d8f (diff) |
Merge pull request #294 from roynatech2544/patch-1
Fix InputFile::fromFile
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; } |