changed: use std::filesystem instead of boost::filesystem
since we still support g++-7, where filesystem is marked experimental, we introduce a wrapper header and expose the namespace to use as Opm::filesystem. for gcc we unconditionally link with libstdc++fs in the python bindings. the setup.py stuff links as c code, not c++ code, so it is not automatically added on any gcc version. this might prove unportable later.
This commit is contained in:
46
opm/common/utility/FileSystem.hpp
Normal file
46
opm/common/utility/FileSystem.hpp
Normal file
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
Copyright 2019 Equinor ASA
|
||||
|
||||
This file is part of the Open Porous Media project (OPM).
|
||||
|
||||
OPM 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 3 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
OPM 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 OPM. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef OPM_FILESYSTEM_HPP
|
||||
#define OPM_FILESYSTEM_HPP
|
||||
|
||||
|
||||
#if __cplusplus__ >= 201703L
|
||||
#include <filesystem>
|
||||
#else
|
||||
#include <experimental/filesystem>
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
|
||||
|
||||
namespace Opm
|
||||
{
|
||||
#if __cplusplus__ >= 201703L
|
||||
namespace filesystem = std::filesystem;
|
||||
#else
|
||||
namespace filesystem = std::experimental::filesystem;
|
||||
#endif
|
||||
|
||||
// A poor man's filesystem::unique_path
|
||||
std::string unique_path(const std::string& input);
|
||||
|
||||
} // end namespace Opm
|
||||
|
||||
|
||||
#endif // OPM_FILESYSTEM_HPP
|
||||
Reference in New Issue
Block a user