OMSimulatorLib
The OMSimulator project is a FMI-based co-simulation environment that supports ordinary (i.e., non-delayed) and TLM connections.
OMSFileSystem.h
Go to the documentation of this file.
1 #ifndef _OMS_FILESYSTEM_H_
2 #define _OMS_FILESYSTEM_H_
3 
4 #if !defined(WITHOUT_FS) && defined(__has_include)
5 
6 #if __has_include(<filesystem>)
7 #include <filesystem>
8 #if __cpp_lib_filesystem >= 201703
9 namespace filesystem = std::filesystem;
10 #define OMC_STD_FS 1
11 #endif
12 #endif
13 
14 #if !defined(OMC_STD_FS) && __has_include(<experimental/filesystem>)
15 #include <experimental/filesystem>
16 namespace filesystem = std::experimental::filesystem::v1;
17 #define OMC_STD_FS 1
18 #endif
19 
20 #endif
21 
22 #if OMC_STD_FS == 1
23 
24 #define OMS_RECURSIVE_DIRECTORY_ITERATOR(path) (filesystem::recursive_directory_iterator{path})
25 
26 #else // boost part
27 
28 #include <string>
29 #include <boost/version.hpp>
30 // boost version < 1.57 has issues linking boost::filesystem::copy_file
31 // https://svn.boost.org/trac10/ticket/6124
32 #if (BOOST_VERSION < 105700)
33 #define BOOST_NO_CXX11_SCOPED_ENUMS
34 #endif // #if (BOOST_VERSION < 105700)
35 #include <boost/filesystem.hpp>
36 #if (BOOST_VERSION < 105700)
37 #undef BOOST_NO_CXX11_SCOPED_ENUMS
38 #endif // #if (BOOST_VERSION < 105700)
39 
40 #if (BOOST_VERSION >= 105300)
41 #include <boost/lockfree/queue.hpp>
42 #endif
43 
44 #if (BOOST_VERSION < 105500)
45 #include <boost/range.hpp>
46 #define OMS_RECURSIVE_DIRECTORY_ITERATOR(path) (boost::make_iterator_range(filesystem::recursive_directory_iterator{path}, {}))
47 #else // older boost
48 #define OMS_RECURSIVE_DIRECTORY_ITERATOR(path) (filesystem::recursive_directory_iterator{path})
49 #endif
50 
51 #include <boost/filesystem.hpp>
52 namespace filesystem = boost::filesystem;
53 #endif
54 
55 filesystem::path naive_uncomplete(const filesystem::path& path, const filesystem::path& base);
56 filesystem::path oms_unique_path(const std::string& prefix);
57 void oms_copy_file(const filesystem::path& from, const filesystem::path& to);
58 filesystem::path oms_canonical(const filesystem::path& p);
59 filesystem::path oms_absolute(const filesystem::path& p);
60 filesystem::path oms_temp_directory_path(void);
61 
62 #endif
filesystem::path oms_canonical(const filesystem::path &p)
Definition: OMSFileSystem.cpp:110
filesystem::path oms_absolute(const filesystem::path &p)
Definition: OMSFileSystem.cpp:139
filesystem::path oms_unique_path(const std::string &prefix)
Definition: OMSFileSystem.cpp:82
void oms_copy_file(const filesystem::path &from, const filesystem::path &to)
Definition: OMSFileSystem.cpp:94
filesystem::path naive_uncomplete(const filesystem::path &path, const filesystem::path &base)
Definition: OMSFileSystem.cpp:51
filesystem::path oms_temp_directory_path(void)
Definition: OMSFileSystem.cpp:144