Skip to content

Commit

Permalink
Merge pull request #294 from roynatech2544/patch-1
Browse files Browse the repository at this point in the history
Fix InputFile::fromFile
  • Loading branch information
reo7sp committed Mar 3, 2024
2 parents f1c2dba + a92beb1 commit f7c17f9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
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)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(WIN32)
Expand Down Expand Up @@ -76,6 +76,7 @@ link_directories(${Boost_LIBRARY_DIR_RELEASE})
if(NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)

set(LIB_LIST
${CMAKE_THREAD_LIBS_INIT}
Expand Down
4 changes: 2 additions & 2 deletions 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>

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

0 comments on commit f7c17f9

Please sign in to comment.