* [#14821](http://bugzilla.scilab.org/show_bug.cgi?id=14821): `getio` function was missing. An error on the diary file opened has been corrected
* [#14839](http://bugzilla.scilab.org/show_bug.cgi?id=14839): `plot2d2` crashed Scilab.
* [#14887](http://bugzilla.scilab.org/show_bug.cgi?id=14887): For many graphic handle types, the display of the `.tag` value missed `".."` delimiters
+* [#14909](http://bugzilla.scilab.org/show_bug.cgi?id=14909): getlongpathname and getshortpathname return values with "\" instead of "/"
### Bugs fixed in 6.0.0 beta-2 and earlier 6.0.0 pre-releases:
FILEIO_IMPEXP int C2F(getshortpathname)(char *pathname, int *len);
-FILEIO_IMPEXP wchar_t* getshortpathnameW(wchar_t* _pwstLongPathName, BOOL* _pbOK);
+FILEIO_IMPEXP wchar_t* getshortpathnameW(const wchar_t* _pwstLongPathName, BOOL* _pbOK);
#endif /* __GETSHORTPATHNAME_H__ */
/*--------------------------------------------------------------------------*/
extern "C"
{
+#include "pathconvert.h"
#include "getlongpathname.h"
#include "Scierror.h"
#include "localization.h"
for (int i = 0 ; i < size; i++)
{
wchar_t* tmp = getlongpathnameW(p[i], (BOOL*)&pBool[i]);
- pOut1->set(i, tmp);
+ wchar_t* pwstPath = pathconvertW(tmp, FALSE, FALSE, AUTO_STYLE);
+ pOut1->set(i, pwstPath);
+ FREE(pwstPath);
FREE(tmp);
}
extern "C"
{
-#include <string.h>
+#include "pathconvert.h"
#include "getshortpathname.h"
#include "sci_malloc.h"
#include "Scierror.h"
for (int i = 0 ; i < size; i++)
{
wchar_t* tmp = getshortpathnameW(p[i], (BOOL*)&pBool[i]);
- pOut1->set(i, tmp);
+ wchar_t* pwstPath = pathconvertW(tmp, FALSE, FALSE, AUTO_STYLE);
+ pOut1->set(i, pwstPath);
+ FREE(pwstPath);
FREE(tmp);
}
}
return types::Function::OK;
- //CheckRhs(0,1);
- //CheckLhs(1,2);
-
- //if (GetType(1) == sci_strings)
- //{
- // int n1 = 0,m1 = 0, m1n1 = 0;
- // char **LongNames = NULL;
- // char **ShortNames = NULL;
- // BOOL *bOK = NULL;
- // int i = 0;
-
- // GetRhsVar(1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,&LongNames);
- // m1n1 = m1*n1;
-
- // if (m1n1 > 0)
- // {
- // ShortNames = (char**) MALLOC(sizeof(char*)* (m1n1));
- // bOK = (BOOL*) MALLOC(sizeof(BOOL)*(m1n1));
-
- // if ( (ShortNames == NULL) || (bOK == NULL) )
- // {
- // freeArrayOfString(LongNames, m1n1);
- // Scierror(999,"%s: Memory allocation error.\n", fname);
- // return 0;
- // }
- // }
-
- // for (i = 0;i < m1n1; i++)
- // {
- // ShortNames[i] = getshortpathname(LongNames[i], &bOK[i]);
- // }
- // freeArrayOfString(LongNames, m1n1);
-
- // CreateVarFromPtr( Rhs+1,MATRIX_OF_STRING_DATATYPE,&m1,&n1,ShortNames);
- // LhsVar(1) = Rhs+1;
-
- // if (Lhs == 2)
- // {
- // CreateVarFromPtr(Rhs+2,MATRIX_OF_BOOLEAN_DATATYPE, &m1, &n1, &bOK);
- // LhsVar(2) = Rhs + 2;
- // }
-
- // C2F(putlhsvar)();
-
- // freeArrayOfString(ShortNames, m1n1);
- // if (bOK) {FREE(bOK); bOK = NULL;}
- //}
- //else
- //{
- // Scierror(999,_("%s: Wrong type for input argument: string expected.\n"),fname);
- //}
- //return 0;
}
/*--------------------------------------------------------------------------*/
#endif
#endif
/*--------------------------------------------------------------------------*/
-char *getlongpathname(char *shortpathname, BOOL *convertok)
+char *getlongpathname(const char *shortpathname, BOOL *convertok)
{
char *LongName = NULL;
wchar_t *wcshortpathname = to_wide_string(shortpathname);
return LongName;
}
/*--------------------------------------------------------------------------*/
-wchar_t *getlongpathnameW(wchar_t *wcshortpathname, BOOL *convertok)
+wchar_t *getlongpathnameW(const wchar_t *wcshortpathname, BOOL *convertok)
{
wchar_t *wcLongName = NULL;
* on Linux returns same path name
* used for Windows
*/
-FILEIO_IMPEXP char *getlongpathname(char *shortpathname, BOOL *convertok);
+FILEIO_IMPEXP char *getlongpathname(const char *shortpathname, BOOL *convertok);
/**
* Retrieves the long path form of the specified path (wide string)
* on Linux returns same path name
* used for Windows
*/
-FILEIO_IMPEXP wchar_t *getlongpathnameW(wchar_t *wcshortpathname, BOOL *convertok);
+FILEIO_IMPEXP wchar_t *getlongpathnameW(const wchar_t *wcshortpathname, BOOL *convertok);
#endif /* __GETLONGPATHNAME_H__ */
return ShortName;
}
/*--------------------------------------------------------------------------*/
-wchar_t* getshortpathnameW(wchar_t* _pwstLongPathName, BOOL* _pbOK)
+wchar_t* getshortpathnameW(const wchar_t* _pwstLongPathName, BOOL* _pbOK)
{
wchar_t* pwstOutput = NULL;
if (_pwstLongPathName)
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - Scilab Enterprises - Antoine ELIAS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+// <-- WINDOWS ONLY -->
+//
+// <-- Non-regression test for bug 14909 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=14909
+//
+// <-- Short Description -->
+// getlongpathname and getshortpathname must return value with "\" instead of "/"
+p = getlongpathname(SCI);
+assert_checkequal(grep(p, "/"), []);
+p = getshortpathname(WSCI);
+assert_checkequal(grep(p, "/"), []);
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2017 - Scilab Enterprises - Antoine ELIAS
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+// <-- WINDOWS ONLY -->
+//
+// <-- Non-regression test for bug 14909 -->
+//
+// <-- Bugzilla URL -->
+// http://bugzilla.scilab.org/show_bug.cgi?id=14909
+//
+// <-- Short Description -->
+// getlongpathname and getshortpathname must return value with "\" instead of "/"
+
+p = getlongpathname(SCI);
+assert_checkequal(grep(p, "/"), []);
+
+p = getshortpathname(WSCI);
+assert_checkequal(grep(p, "/"), []);
+