From 5e8f7d7f7c366c11ad835458a54089e61283e889 Mon Sep 17 00:00:00 2001
From: Federico Felici <federico.felici@epfl.ch>
Date: Tue, 23 Nov 2021 18:18:58 +0100
Subject: [PATCH] Clean dd from git root level

---
 code/classes/SCD.m | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/code/classes/SCD.m b/code/classes/SCD.m
index aab9167..6f91986 100644
--- a/code/classes/SCD.m
+++ b/code/classes/SCD.m
@@ -48,12 +48,15 @@ classdef SCD
  
   function clean_dd()
     % Close all data open dictionaries
-    fprintf('Closing all data dictionaries and discarding changes')
+    fprintf('Closing all data dictionaries and discarding changes\n')
     Simulink.data.dictionary.closeAll('-discard');
     % Cleans unversioned data dictionaries
     fprintf('Cleaning unversioned data dictionaries for clean test\n')
+    [~,s] = system('git rev-parse --show-toplevel');  % get top-level dir
+    oldpwd = pwd; cd(deblank(s));
     system('git clean -xf *.sldd');  % clean local sldd
     system('git submodule foreach --quiet ''git clean -fx *.sldd'''); % clean submodules too
+    cd(oldpwd)
   end
   
   function SCDexps = getexpcodecontainer()
-- 
GitLab