9
9
10
10
#define _CRT_SECURE_NO_WARNINGS
11
11
12
- #include < boost/filesystem.hpp>
13
- #include < boost/filesystem/fstream.hpp>
14
12
#include < string>
15
13
#include < iostream>
16
14
#include < fstream>
23
21
#include < streambuf>
24
22
#include < sstream>
25
23
26
- namespace fs = boost::filesystem;
24
+ #ifdef BOOSTDEP_USE_STD_FS
25
+ #include < filesystem>
26
+ namespace fs = std::filesystem;
27
+ #else
28
+ #include < boost/filesystem.hpp>
29
+ #include < boost/filesystem/fstream.hpp>
30
+ namespace fs = boost::filesystem;
31
+ #endif
32
+
33
+
27
34
28
35
// header -> module
29
36
static std::map< std::string, std::string > s_header_map;
@@ -50,7 +57,7 @@ static void scan_module_headers( fs::path const & path )
50
57
51
58
for ( ; it != last; ++it )
52
59
{
53
- if ( it->status (). type () == fs::directory_file )
60
+ if ( fs::is_directory ( it->status () ) )
54
61
{
55
62
continue ;
56
63
}
@@ -76,7 +83,7 @@ static void scan_submodules( fs::path const & path )
76
83
{
77
84
fs::directory_entry const & e = *it;
78
85
79
- if ( e. status (). type () != fs::directory_file )
86
+ if ( ! fs::is_directory ( it-> status () ) )
80
87
{
81
88
continue ;
82
89
}
@@ -211,7 +218,7 @@ static void scan_module_path( fs::path const & dir, bool remove_prefix, std::map
211
218
212
219
for ( ; it != last; ++it )
213
220
{
214
- if ( it->status (). type () == fs::directory_file )
221
+ if ( fs::is_directory ( it->status () ) )
215
222
{
216
223
continue ;
217
224
}
@@ -223,7 +230,11 @@ static void scan_module_path( fs::path const & dir, bool remove_prefix, std::map
223
230
header = header.substr ( n+1 );
224
231
}
225
232
233
+ #ifdef BOOSTDEP_USE_STD_FS
234
+ std::ifstream is ( it->path () );
235
+ #else
226
236
fs::ifstream is ( it->path () );
237
+ #endif
227
238
228
239
scan_header_dependencies ( header, is, deps, from );
229
240
}
@@ -1669,7 +1680,7 @@ static void add_module_headers( fs::path const & dir, std::set<std::string> & he
1669
1680
1670
1681
for ( ; it != last; ++it )
1671
1682
{
1672
- if ( it->status (). type () == fs::directory_file )
1683
+ if ( fs::is_directory ( it->status () ) )
1673
1684
{
1674
1685
continue ;
1675
1686
}
0 commit comments