summaryrefslogtreecommitdiff
path: root/cleaner.sce
blob: aab2d3e42a11e5cc426ad43bdad98f6f38b03007 (plain)
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
// This file is released under the 3-clause BSD license. See COPYING-BSD.
// Generated by builder.sce: Please, do not edit this file

oldmode = mode();
oldlines = lines()(2);
lines(0);

function perform_clean()
    root_tlbx = get_absolute_file_path('cleaner.sce');

    if isfile(root_tlbx + '/macros/cleanmacros.sce') then
        exec(root_tlbx+'/macros/cleanmacros.sce');
    else
        if isdir(root_tlbx + "/macros/") then
            deletefile(root_tlbx + "/macros/lib");
            binfiles = findfiles(root_tlbx + "/macros/", "*.bin");
            if ~isempty(binfiles) then
                deletefile(root_tlbx + "/macros/" + binfiles);
            end
        end
    end

    if isfile(root_tlbx + "/src/cleaner_src.sce") then
        exec(root_tlbx + "/src/cleaner_src.sce");
        mdelete(root_tlbx + "/src/cleaner_src.sce");
     end

    if isfile(root_tlbx + "/sci_gateway/cleaner_gateway.sce") then
        exec(root_tlbx + "/sci_gateway/cleaner_gateway.sce");
        mdelete(root_tlbx + "/sci_gateway/cleaner_gateway.sce");
     end

    if isfile(root_tlbx + "/help/cleaner_help.sce") then
        exec(root_tlbx + "/help/cleaner_help.sce");
    else
        if isdir(root_tlbx + "/jar/") then
            rmdir(root_tlbx + "/jar/", "s");
        end
    end

    if isfile(root_tlbx + "/loader.sce") then
        mdelete(root_tlbx + "/loader.sce");
    end

    if isfile(root_tlbx + "/unloader.sce") then
        mdelete(root_tlbx + "/unloader.sce");
    end
endfunction

try
    perform_clean();
catch
    [errmsg, tmp, nline, func] = lasterror();
    msg = "%s: error on line #%d: ""%s""\n";
    msg = msprintf(msg, func, nline, errmsg);
    lines(oldlines);
    mode(oldmode);
    clear perform_clean oldlines oldmode tmp nline func errmsg;
    error(msg);
end

lines(oldlines)
mode(oldmode);
clear perform_clean oldlines oldmode;