summaryrefslogtreecommitdiff
path: root/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci
diff options
context:
space:
mode:
authoryash11122017-07-07 21:20:49 +0530
committeryash11122017-07-07 21:20:49 +0530
commit9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0 (patch)
treef50d6e06d8fe6bc1a9053ef10d4b4d857800ab51 /2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci
downloadScilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.gz
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.tar.bz2
Scilab2C-9e5793a7b05b23e6044a6d7a9ddd5db39ba375f0.zip
sci2c arduino updated
Diffstat (limited to '2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci')
-rw-r--r--2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci74
1 files changed, 74 insertions, 0 deletions
diff --git a/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci b/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci
new file mode 100644
index 00000000..4d72ab78
--- /dev/null
+++ b/2.3-1/macros/ToolInitialization/INIT_RemoveDirs.sci
@@ -0,0 +1,74 @@
+function INIT_RemoveDirs(FileInfo,SharedInfoRunMode)
+// function INIT_RemoveDirs(FileInfo,SharedInfoRunMode)
+// -----------------------------------------------------------------
+// #RNU_RES_B
+// Removes existing directories according to the RunMode
+// specified by the user.
+//
+// Input data:
+// FileInfo: structure containing all info about SCI2C files.
+// SharedInfoRunMode: execution mode specified by the user in
+// the SCI2CInputParameters.sce file.
+//
+// Output data:
+// ---
+//
+// #RNU_RES_E
+// Status:
+// 03-Jan-2008 -- Raffaele Nutricato: Author.
+//
+// Copyright 2008 Raffaele Nutricato.
+// Contact: raffaele.nutricato@tiscali.it
+// -----------------------------------------------------------------
+
+// ------------------------------
+// --- Check input arguments. ---
+// ------------------------------
+SCI2CNInArgCheck(argn(2),2,2);
+
+// ----------------------------------------------------
+// --- Remove previous versions of SCI2C files/dir. ---
+// ----------------------------------------------------
+if (SharedInfoRunMode == 'GenLibraryStructure' | SharedInfoRunMode == 'All')
+ disp('Removing directory: '+FileInfo.WorkingDir);
+ disp('Removing directory: '+FileInfo.OutCCCodeDir);
+ // Remove software<->user interaction.
+ // yesno=input('Are you sure [y/n]?','string');
+ yesno = 'y';
+
+ if (yesno=='y')
+ rmdir(FileInfo.WorkingDir,'s'); // delete WorkingDir if it exists due to previous translations...
+ mdelete(FileInfo.OutCCCodeDir+'/*.h'); // delete .h files generated in previous translations (if any).
+ mdelete(FileInfo.OutCCCodeDir+'/*.c'); // delete .c files generated in previous translations (if any).
+ mdelete(FileInfo.OutCCCodeDir+'/*.cpp'); // delete .cpp files generated in previous translations (if any).
+ mdelete(FileInfo.OutCCCodeDir+'/Makefile'); // delete .h files generated in previous translations (if any).
+ // Note I don't delete includes, interfaces and and src directories to avoid recompiling them every time
+ // a new translation is launched. I only delete source files generated by user.
+
+ else
+ SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.WorkingDir);
+ SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.OutCCCodeDir);
+ end
+elseif (SharedInfoRunMode == 'Translate')
+ // #RNU_RES_B
+ //NUT: non cancella le cartelle dei file C creati nella iterazione precedente
+ //NUT: occorre specificarlo bene nel manuale.
+ // #RNU_RES_E
+ disp('Removing directory: '+FileInfo.OutCCCodeDir);
+ // Remove software<->user interaction.
+ // yesno=input('Are you sure [y/n]?','string');
+ yesno = 'y';
+ if (yesno=='y')
+ rmdir(FileInfo.OutCCCodeDir,'s');
+ else
+ SCI2Cerror('Cannot continue, because you don''t want to delete: '+FileInfo.OutCCCodeDir);
+ end
+elseif (SharedInfoRunMode == 'FunCall')
+ //Do nothing
+else
+ disp('Unknown RunMode: ""'+SharedInfoRunMode+'"".');
+ disp('Please check RunMode parameter in the SCI2CInputParameters.sce file');
+ SCI2Cerror(' ');
+end
+
+endfunction