From d4972161bc8a160740c8006dd244c9d00577f6bd Mon Sep 17 00:00:00 2001
From: Pantelis Sopasakis
Date: Tue, 2 Oct 2018 16:06:51 +0300
Subject: [PATCH] :hammer: using absolute root dir using absolute paths in
demos
---
demos/prepare_demo_trailer.m | 3 ++-
get_nmpc_codegen_matlab_rootdir.m | 4 ++++
2 files changed, 6 insertions(+), 1 deletion(-)
create mode 100644 get_nmpc_codegen_matlab_rootdir.m
diff --git a/demos/prepare_demo_trailer.m b/demos/prepare_demo_trailer.m
index 72288b5..7feade0 100644
--- a/demos/prepare_demo_trailer.m
+++ b/demos/prepare_demo_trailer.m
@@ -4,7 +4,8 @@
% enviroment. (output location is repo/test_controller_builds/demo_controller_matlab)
% generate static files
- trailer_controller_output_location = ['../test_controller_builds/' controller_folder_name];
+ rootdir = get_nmpc_codegen_matlab_rootdir();
+ trailer_controller_output_location = fullfile(rootdir, 'test_controller_builds', controller_folder_name);
nmpccodegen.tools.Bootstrapper.bootstrap(trailer_controller_output_location, true);
% get example model from lib
diff --git a/get_nmpc_codegen_matlab_rootdir.m b/get_nmpc_codegen_matlab_rootdir.m
new file mode 100644
index 0000000..87fb2c2
--- /dev/null
+++ b/get_nmpc_codegen_matlab_rootdir.m
@@ -0,0 +1,4 @@
+function rootdir = get_nmpc_codegen_matlab_rootdir()
+rootdir = which('get_nmpc_codegen_matlab_rootdir');
+tokens = strsplit(rootdir, 'get_nmpc_codegen_matlab_rootdir.m');
+rootdir = tokens{1};
\ No newline at end of file