1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
// Copyright (C) INRIA
// Copyright (C) ENPC
//
// This file must be used under the terms of the CeCILL.
// This source file is licensed as described in the file COPYING, which
// you should have received as part of this distribution. The terms
// are also available at
// http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
function getd(path,option)
// get all .sci files in the specified directory
[lhs,rhs]=argn(0);
if rhs<=0 then
path="./";
end
// convert path according to getos() == 'Windows' flag
// and with env var substitutions
path = pathconvert(path,%t,%t);
// list the sci files
lst = listfiles(path+"*.sci",%f);
lst_filtered = [];
// remove wrong files extension
// bug 2289
for i=1:size(lst,"*")
if( regexp(lst(i),"/.sci$/") <> [] ) then
lst_filtered = [lst_filtered;lst(i)];
end
end
lst = lst_filtered;
clear lst_filtered;
if lst==[] | lst== "" then
error(msprintf(gettext("%s: I cannot find any files with extension %s in %s\n"),"getd",".sci",path));
return ;
end
nold = size(who("get"),"*")
//prot = funcprot();funcprot(0)
for k=1:size(lst,"*");
if fileparts(lst(k),"extension")==".sci" then
if execstr("exec(lst(k));","errcatch")<>0 then
warning(msprintf(gettext("%s: Incorrect function in file %s.\n"),"getd",lst(k)))
end
end
end
//funcprot(prot);
new = who("get");
new = new(1:(size(new,"*")-nold-2)); // -4 becomes -2: fix the fix for bug 2807
if new<>[] then
execstr("["+strcat(new,",")+"]=resume("+strcat(new,",")+")")
end
endfunction
|