Add "load" function
[scilab.git] / scilab / modules / atoms / macros / atomsGetLoaded.sci
1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2009 - DIGITEO - Pierre MARECHAL <pierre.marechal@scilab.org>
3 //
4 // This file must be used under the terms of the CeCILL.
5 // This source file is licensed as described in the file COPYING, which
6 // you should have received as part of this distribution.  The terms
7 // are also available at
8 // http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
9
10 // End user function
11
12 // Return a 4xn string matrix :
13 // 
14 // !toolbox2          0.1  user     /home/pmarecha/.Scilab/scilab-branch-atoms/atoms/contrib/toolbox2/0.1  A  !
15 // !                                                                                                          !
16 // !toolbox2          0.2  user     /home/pmarecha/.Scilab/scilab-branch-atoms/atoms/contrib/toolbox2/0.2  A  !
17 // !                                                                                                          !
18 // !toolbox_skeleton  1.3  alluser  /home/pmarecha/work/atoms/scilab/contrib/toolbox_skeleton/1.3          I  !
19
20 function packages = atomsGetLoaded()
21         
22         packages = [];
23         
24         // Define the differents path of the file where are installed
25         // =========================================================================
26         loaded_file   = pathconvert(TMPDIR+"/atoms/loaded",%F);
27         
28         if fileinfo(loaded_file) == [] then
29                 packages = [];
30                 return;
31         end
32         
33         // load the loaded_file
34         // =========================================================================
35         loaded = mgetl(loaded_file);
36         
37         // Loop on each URL specified as first input argument
38         // =========================================================================
39         
40         for i=1:size(loaded,"*")
41                 current_name_length  = regexp(loaded(i),"/\s-\s/","o");
42                 current_name         = part(loaded(i),1:current_name_length-1);
43                 current_version      = part(loaded(i),current_name_length+3:length(loaded(i)));
44                 
45                 packages = [ packages ; atomsGetInstalledDetails(current_name,current_version) ];
46         end
47         
48 endfunction