1 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
2 // Copyright (C) 2012 - DIGITEO - Simon GARESTE <simon.gareste@scilab.org>
4 // Copyright (C) 2012 - 2016 - Scilab Enterprises
6 // This file is hereby licensed under the terms of the GNU GPL v2.0,
7 // pursuant to article 5.3.4 of the CeCILL v.2.1.
8 // This file was originally licensed under the terms of the CeCILL v2.1,
9 // and continues to be available under such terms.
10 // For more information, see the COPYING file which you should have received
11 // along with this program.
13 // Save the config file in a config.bak file, so that we don't lose information while testing
15 function atomsSaveConfig(force)
20 error(msprintf(gettext("%s: Wrong number of input arguments: %d to %d expected.\n"),"atomsSaveConfig",0,1));
23 load("SCI/modules/atoms/macros/atoms_internals/lib");
29 pathsystemuser = atomsPath("system", "user");
31 proxy_attrs = ["enabled", "host", "port", "user", "password"];
32 xmlSetValues("//web/body/previous-proxy", [proxy_attrs ; xmlGetValues("//web/body/proxy", proxy_attrs)]);
34 if isfile(pathsystemuser + "config.bak") then
36 error(msprintf("The file config.bak already exists, aborting.\n"));
37 elseif isfile(pathsystemuser + "config") then
38 copyfile(pathsystemuser + "config", pathsystemuser + "config.bak");
39 msprintf(gettext("config file saved to %s"), pathsystemuser + "config.bak");
41 error(msprintf("No config available, aborting.\n"));
43 elseif isfile(pathsystemuser + "config") then
44 copyfile(pathsystemuser + "config", pathsystemuser + "config.bak");
45 msprintf(gettext("config file saved to %s"), pathsystemuser + "config.bak");
46 elseif ~isdir(pathsystemuser) then
48 mputl("", pathsystemuser + "config");
49 mputl("", pathsystemuser + "config.bak");
51 mputl("", pathsystemuser + "config");
52 mputl("", pathsystemuser + "config.bak");