2 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 * Copyright (C) 2011 - DIGITEO - Bruno JOFRET
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.
15 /*--------------------------------------------------------------------------*/
16 #include "fileio_gw.hxx"
17 #include "function.hxx"
23 #include "pathconvert.h"
24 #include "getlongpathname.h"
26 #include "localization.h"
28 /*--------------------------------------------------------------------------*/
29 types::Function::ReturnValue sci_getlongpathname(types::typed_list &in, int _iRetCount, types::typed_list &out)
33 Scierror(999, _("%s: Wrong number of input arguments: %d expected.\n"), "getlongpathname" , 1);
34 return types::Function::Error;
37 if (_iRetCount != 1 && _iRetCount != 2)
39 Scierror(78, _("%s: Wrong number of output argument(s): %d to %d expected.\n"), "getlongpathname", 1, 2);
40 return types::Function::Error;
43 if (in[0]->isString() == false)
45 Scierror(999, _("%s: Wrong type for input argument #%d: Matrix of strings expected.\n"), "getlongpathname", 1);
46 return types::Function::Error;
49 types::String* pS = in[0]->getAs<types::String>();
51 types::String* pOut1 = new types::String(pS->getRows(), pS->getCols());
52 types::Bool* pOut2 = new types::Bool(pS->getRows(), pS->getCols());
53 int* pBool = pOut2->get();
54 int size = pS->getSize();
55 wchar_t** p = pS->get();
56 for (int i = 0 ; i < size; i++)
58 wchar_t* tmp = getlongpathnameW(p[i], (BOOL*)&pBool[i]);
59 wchar_t* pwstPath = pathconvertW(tmp, FALSE, FALSE, AUTO_STYLE);
60 pOut1->set(i, pwstPath);
75 return types::Function::OK;
77 /*--------------------------------------------------------------------------*/