oatpp-swagger
oatpp-swagger copied to clipboard
Windows Support
I tried to build and install it on windows. there is just one mistake in Resource.cpp which can be fixed through this otherwise the favicon and so on will be having a file path like "C:\dev\my-service\lib\oatpp-swagger\res/favicon-16x16.png" which cannot be load:
#ifdef _WIN32
const char otapp_char_directory_separator = '\\';
const String otapp_string_directory_separator("\\");
#else
const char otapp_char_directory_separator = '/';
const String otapp_string_directory_separator = "/";
#endif
Resources::Resources(const oatpp::String& resDir, bool streaming) {
if(!resDir || resDir->size() == 0) {
throw std::runtime_error("[oatpp::swagger::Resources::Resources()]: Invalid resDir path. Please specify full path to oatpp-swagger/res folder");
}
m_resDir = resDir;
if(m_resDir->data()[m_resDir->size() - 1] != otapp_char_directory_separator) {
m_resDir = m_resDir + otapp_string_directory_separator;
}
m_streaming = streaming;
}
I think it could be done even better with c++17 since there is a system path library included. But I haven't tried that yet.