2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2012 - Scilab Enterprises - Calixte DENIZET
5 * Copyright (C) 2012 - 2016 - Scilab Enterprises
7 * This file is hereby licensed under the terms of the GNU GPL v2.0,
8 * pursuant to article 5.3.4 of the CeCILL v.2.1.
9 * This file was originally licensed under the terms of the CeCILL v2.1,
10 * and continues to be available under such terms.
11 * For more information, see the COPYING file which you should have received
12 * along with this program.
21 #include "getScilabJavaVM.h"
23 #include "api_scilab.h"
24 #include "localization.h"
25 #include "expandPathVariable.h"
26 #include "sci_malloc.h"
28 #include "gw_graphic_export.h"
31 /*--------------------------------------------------------------------------*/
32 int sci_xinit(char * fname, void *pvApiCtx)
39 CheckInputArgument(pvApiCtx, 1, 1);
41 err = getVarAddressFromPosition(pvApiCtx, 1, &addr);
45 Scierror(999, _("%s: Can not read input argument #%d.\n"), fname, 1);
49 if (!isStringType(pvApiCtx, addr) || !checkVarDimension(pvApiCtx, addr, 1, 1))
51 Scierror(999, gettext("%s: Wrong type for input argument #%d: string expected.\n"), fname, 1);
55 if (getAllocatedSingleString(pvApiCtx, addr, &path) != 0)
57 Scierror(999, _("%s: No more memory.\n"), fname);
61 realPath = expandPathVariable(path);
65 org_scilab_modules_graphic_export::Driver::setPath(getScilabJavaVM(), realPath);
70 Scierror(999, _("%s: Invalid path: %s.\n"), fname, path);
71 freeAllocatedSingleString(path);
75 freeAllocatedSingleString(path);
82 /*--------------------------------------------------------------------------*/