Skip to content

Commit a2ff638

Browse files
smowtonpeterschrammel
authored andcommitted
Use boost instead of mkdir -p if available
This saves a lot of time if you're generating a large tree.
1 parent a7022f1 commit a2ff638

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/config.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ BUILD_ENV = AUTO
1111
#CXXFLAGS += -O2 -DNDEBUG
1212
#CXXFLAGS += -O0 -g
1313

14+
LIBS=-lboost_filesystem -lboost_system
15+
1416
# If GLPK is available; this is used by goto-instrument and musketeer.
1517
#LIB_GLPK = -lglpk
1618

src/util/file_util.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ Date: January 2012
3232
#define pclose _pclose
3333
#endif
3434

35+
#ifdef USE_BOOST
36+
#include <boost/filesystem.hpp>
37+
#endif
38+
3539
#include "file_util.h"
3640

3741

@@ -238,10 +242,14 @@ void fileutl_create_directory(std::string const& pathname)
238242
# if defined(WIN32)
239243
std::system((std::string("mkdir \"") + pathname + "\"").c_str());
240244
# elif defined(__linux__) || defined(__APPLE__)
245+
#ifdef USE_BOOST
246+
boost::filesystem::create_directories(pathname);
247+
#else
241248
auto ignore = std::system(
242249
(std::string("mkdir -p \"") + pathname + "\"").c_str()
243250
);
244251
(void)ignore;
252+
#endif
245253
# else
246254
# error "Unsuported platform."
247255
# endif

0 commit comments

Comments
 (0)