From 8fcdfb8cb251408f254abdf54c5ca45de7651360 Mon Sep 17 00:00:00 2001 From: Richard Roberts Date: Fri, 4 Nov 2011 11:58:22 +0000 Subject: [PATCH] Don't need to 'cd' to toolbox directory to run 'make_gtsam' in matlab --- wrap/Module.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/wrap/Module.cpp b/wrap/Module.cpp index 374e25584..7e35b0d2b 100644 --- a/wrap/Module.cpp +++ b/wrap/Module.cpp @@ -191,7 +191,10 @@ void Module::matlab_code(const string& toolboxPath, if (verbose_) cerr << "generating " << makeFile << endl; emit_header_comment(ofs,"%"); ofs << "echo on" << endl << endl; - ofs << "toolboxpath = pwd" << endl; + ofs << "toolboxpath = mfilename('fullpath');" << endl; + ofs << "delims = find(toolboxpath == '/');" << endl; + ofs << "toolboxpath = toolboxpath(1:(delims(end)-1));" << endl; + ofs << "clear delims" << endl; ofs << "addpath(toolboxpath);" << endl << endl; // generate proxy classes and wrappers