Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix InputFile::fromFile #294

Merged
merged 3 commits into from
Mar 3, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF)
option(BUILD_DOCUMENTATION "Build doxygen API documentation." OFF)

# sources
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
Royna2544 marked this conversation as resolved.
Show resolved Hide resolved
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(WIN32)
Expand Down
4 changes: 2 additions & 2 deletions src/types/InputFile.cpp
Original file line number Diff line number Diff line change
@@ -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>

Expand All @@ -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;
}

Expand Down
Loading