From ac150043bdf83240add766c5810943d69a7d5a91 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Wed, 23 May 2012 21:23:27 +0000 Subject: [PATCH] Fixed wrap under windows --- wrap/Module.cpp | 9 +++++---- wrap/tests/testWrap.cpp | 11 +++++------ 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/wrap/Module.cpp b/wrap/Module.cpp index dfd781016..98525e65d 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -25,12 +25,14 @@ #include #include #include +#include #include using namespace std; using namespace wrap; using namespace BOOST_SPIRIT_CLASSIC_NS; +namespace fs = boost::filesystem; typedef rule Rule; @@ -279,8 +281,8 @@ void verifyReturnTypes(const vector& validtypes, const vector& vt) { /* ************************************************************************* */ void Module::matlab_code(const string& toolboxPath, const string& mexExt, const string& mexFlags) const { - string installCmd = "install -d " + toolboxPath; - system(installCmd.c_str()); + + fs::create_directories(toolboxPath); // create make m-file string matlabMakeFileName = toolboxPath + "/make_" + name + ".m"; @@ -327,8 +329,7 @@ void Module::matlab_code(const string& toolboxPath, BOOST_FOREACH(Class cls, classes) { // create directory if needed string classPath = toolboxPath + "/@" + cls.qualifiedName(); - string installCmd = "install -d " + classPath; - system(installCmd.c_str()); + fs::create_directories(classPath); // create proxy class string classFile = classPath + "/" + cls.qualifiedName() + ".m"; diff --git a/wrap/tests/testWrap.cpp b/wrap/tests/testWrap.cpp index cdee692a5..91b2161f7 100644 --- a/wrap/tests/testWrap.cpp +++ b/wrap/tests/testWrap.cpp @@ -20,6 +20,7 @@ #include #include #include +#include #include #include @@ -28,6 +29,7 @@ using namespace std; using namespace boost::assign; using namespace wrap; +namespace fs = boost::filesystem; static bool enable_verbose = false; #ifdef TOPSRCDIR static string topdir = TOPSRCDIR; @@ -57,8 +59,7 @@ TEST( wrap, check_exception ) { CHECK_EXCEPTION(Module("/alsonotarealpath", "geometry",enable_verbose), CantOpenFile); // clean out previous generated code - string cleanCmd = "rm -rf actual_deps"; - system(cleanCmd.c_str()); + fs::remove_all("actual_deps"); string path = topdir + "/wrap/tests"; Module module(path.c_str(), "testDependencies",enable_verbose); @@ -208,8 +209,7 @@ TEST( wrap, matlab_code_namespaces ) { string path = topdir + "/wrap"; // clean out previous generated code - string cleanCmd = "rm -rf actual_namespaces"; - system(cleanCmd.c_str()); + fs::remove_all("actual_namespaces"); // emit MATLAB code string exp_path = path + "/tests/expected_namespaces/"; @@ -263,8 +263,7 @@ TEST( wrap, matlab_code ) { string path = topdir + "/wrap"; // clean out previous generated code - string cleanCmd = "rm -rf actual"; - system(cleanCmd.c_str()); + fs::remove_all("actual"); // emit MATLAB code // make_geometry will not compile, use make testwrap to generate real make