File tree Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Expand file tree Collapse file tree 2 files changed +18
-15
lines changed Original file line number Diff line number Diff line change @@ -13,7 +13,6 @@ BUILD_ENV = AUTO
1313
1414ifeq ($(shell uname ), Linux )
1515 CXXFLAGS += -DUSE_BOOST
16- LIBS = -lboost_filesystem -lboost_system
1716endif
1817
1918# On Windows this Makefile is subject to sed s/BUILD_ENV.*/BUILD_ENV = MSVC,
Original file line number Diff line number Diff line change @@ -45,10 +45,6 @@ Date: January 2012
4545#include < cstring>
4646#endif
4747
48- #ifdef USE_BOOST
49- #include < boost/filesystem.hpp>
50- #endif
51-
5248#include " file_util.h"
5349
5450
@@ -238,18 +234,26 @@ std::string fileutl_remove_extension(std::string const &filename)
238234void fileutl_create_directory (std::string const &pathname)
239235{
240236# if defined(WIN32)
241- std::system ((std::string (" mkdir \" " ) + pathname + " \" " ).c_str ());
242- # elif defined(__linux__) || defined(__APPLE__)
243- #ifdef USE_BOOST
244- boost::filesystem::create_directories (pathname);
237+ char path_sep=' \\ ' ;
245238#else
246- auto ignore = std::system (
247- (std::string (" mkdir -p \" " ) + pathname + " \" " ).c_str ());
248- (void )ignore;
239+ char path_sep=' /' ;
249240#endif
250- # else
251- # error "Unsuported platform."
252- # endif
241+ std::size_t search_from=0 ;
242+ while (search_from!=std::string::npos)
243+ {
244+ // Search from after the previous path separator, incidentally
245+ // skipping trying to create '/' if an absolute path is given
246+ search_from=pathname.find (path_sep, search_from+1 );
247+ std::string truncated_pathname=pathname.substr (0 , search_from);
248+ #if defined(WIN32)
249+ _mkdir (truncated_pathname.c_str ());
250+ #else
251+ mkdir (truncated_pathname.c_str (), 0777 );
252+ #endif
253+ // Ignore return-- regardless of why we can't create a
254+ // path prefix, we might as well keep trying down to more
255+ // specific paths.
256+ }
253257}
254258
255259std::string fileutl_concatenate_file_paths (
You can’t perform that action at this time.
0 commit comments