diff options
author | Shauren <shauren.trinity@gmail.com> | 2021-05-24 00:08:03 +0200 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2021-05-24 00:08:03 +0200 |
commit | 3c08eb190f8fff96a17c6cb61892f813940648ce (patch) | |
tree | a331027f60283389b9b5cd2cda2805490418e543 /src | |
parent | ce37c24481c6ab6863c1fc3be037aa56c54520ea (diff) |
Core/Misc: Add another boost hack. Fixes bnetserver/worldserver -c command line parameter when path contains spaces
Diffstat (limited to 'src')
-rw-r--r-- | src/common/Hacks/boost_1_74_fibonacci_heap.h | 4 | ||||
-rw-r--r-- | src/common/Hacks/boost_program_options_with_filesystem_path.h | 46 | ||||
-rw-r--r-- | src/server/bnetserver/Main.cpp | 2 | ||||
-rw-r--r-- | src/server/worldserver/Main.cpp | 2 |
4 files changed, 52 insertions, 2 deletions
diff --git a/src/common/Hacks/boost_1_74_fibonacci_heap.h b/src/common/Hacks/boost_1_74_fibonacci_heap.h index 0ebf69cdde3..4eeff5c3ce4 100644 --- a/src/common/Hacks/boost_1_74_fibonacci_heap.h +++ b/src/common/Hacks/boost_1_74_fibonacci_heap.h @@ -23,7 +23,7 @@ #if TRINITY_COMPILER == TRINITY_COMPILER_MICROSOFT && BOOST_VERSION == 107400 #define BOOST_1_74_FIBONACCI_HEAP_MSVC_COMPILE_FIX(T) \ -namespace boost::heap::detail \ +namespace boost { namespace heap { namespace detail \ { \ template<class Node> \ void destroy_node(Node& node) \ @@ -53,7 +53,7 @@ namespace boost::heap::detail \ allocator& _alloc; \ }; \ -} +} } } #else #define BOOST_1_74_FIBONACCI_HEAP_MSVC_COMPILE_FIX(T) #endif diff --git a/src/common/Hacks/boost_program_options_with_filesystem_path.h b/src/common/Hacks/boost_program_options_with_filesystem_path.h new file mode 100644 index 00000000000..64decf69a11 --- /dev/null +++ b/src/common/Hacks/boost_program_options_with_filesystem_path.h @@ -0,0 +1,46 @@ +/* + * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the + * Free Software Foundation; either version 2 of the License, or (at your + * option) any later version. + * + * This program is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along + * with this program. If not, see <http://www.gnu.org/licenses/>. + */ + +#ifndef HACKS_boost_program_options_with_filesystem_path_h__ +#define HACKS_boost_program_options_with_filesystem_path_h__ + +#include <boost/filesystem/path.hpp> +#include <boost/program_options/value_semantic.hpp> + +namespace boost +{ +namespace filesystem +{ + static void validate(boost::any& v, std::vector<std::string> const& values, path* /*target_type_tag*/, int) + { + using namespace boost::program_options; + + validators::check_first_occurrence(v); + std::string const& s = validators::get_single_string(values); + try + { + v = path(s); + } + catch (std::exception const&) + { + throw validation_error(invalid_option_value(s)); + } + } +} +} + +#endif // HACKS_boost_program_options_with_filesystem_path_h__ diff --git a/src/server/bnetserver/Main.cpp b/src/server/bnetserver/Main.cpp index 58ea4d52034..c4d87548fc4 100644 --- a/src/server/bnetserver/Main.cpp +++ b/src/server/bnetserver/Main.cpp @@ -46,6 +46,8 @@ #include <iostream> #include <csignal> +#include "Hacks/boost_program_options_with_filesystem_path.h" + using boost::asio::ip::tcp; using namespace boost::program_options; namespace fs = boost::filesystem; diff --git a/src/server/worldserver/Main.cpp b/src/server/worldserver/Main.cpp index aea48b8ce93..8e3452940a7 100644 --- a/src/server/worldserver/Main.cpp +++ b/src/server/worldserver/Main.cpp @@ -58,6 +58,8 @@ #include <iostream> #include <csignal> +#include "Hacks/boost_program_options_with_filesystem_path.h" + using namespace boost::program_options; namespace fs = boost::filesystem; |