* [#16139](http://bugzilla.scilab.org/show_bug.cgi?id=16139): `auread()` and `auwrite()` kept the sound file open and locked when returning on errors. They poorly handled the default .au sound file extension.
* [#16143](http://bugzilla.scilab.org/show_bug.cgi?id=16143): `clc(n)` cleared n+1 lines instead of n>0. Thus, it was not possible to clear only one line.
* [#16144](http://bugzilla.scilab.org/show_bug.cgi?id=16144): Addition of sparse matrices gave incorrect results.
+* [#16149](http://bugzilla.scilab.org/show_bug.cgi?id=16149): `fullpath` did not support symbolic links in paths
* [#16152](http://bugzilla.scilab.org/show_bug.cgi?id=16152): For sparse or boolean sparse matrix `s`, `s([])` returned `[]` instead of `sparse([])`.
* [#16158](http://bugzilla.scilab.org/show_bug.cgi?id=16158): When a multicolumn array of rationals was displayed wide column per column, columns #2:$ were replaced with its column #2.
* [#16160](http://bugzilla.scilab.org/show_bug.cgi?id=16160): `ppol` changed values of third input variable.
DEBUG_CXXFLAGS="-DNDEBUG -g1 -O2"
fi
COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fno-stack-protector " # bug 3131
+ COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -lstdc++fs" # required on Ubuntu
;;
esac
$as_echo_n "checking to see if the java compiler works... " >&6; }
cat << \EOF > conftest.java
-// #line 12446 "configure"
+// #line 12447 "configure"
import java.util.regex.Pattern;
if test "x$ac_java_jvm_name" = "x" ; then
cat << \EOF > conftest.java
-// #line 12533 "configure"
+// #line 12534 "configure"
import java.util.regex.Pattern;
import gnu.java.io.EncodingManager;
# The class java.nio.charset.Charset is new to 1.4
cat << \EOF > conftest.java
-// #line 12617 "configure"
+// #line 12618 "configure"
import java.util.regex.Pattern;
import java.nio.charset.Charset;
# The class java.lang.StringBuilder is new to 1.5
cat << \EOF > conftest.java
-// #line 12682 "configure"
+// #line 12683 "configure"
import java.util.regex.Pattern;
import java.lang.StringBuilder;
# The class java.util.ArrayDeque is new to 1.6
cat << \EOF > conftest.java
-// #line 12747 "configure"
+// #line 12748 "configure"
import java.util.regex.Pattern;
import java.util.ArrayDeque;
# The class java.nio.file.Path is new to 1.7
cat << \EOF > conftest.java
-// #line 12812 "configure"
+// #line 12813 "configure"
import java.util.regex.Pattern;
import java.nio.file.Path;
# The class java.util.stream.DoubleStream is new to 1.8
cat << \EOF > conftest.java
-// #line 12877 "configure"
+// #line 12878 "configure"
import java.util.regex.Pattern;
import java.util.stream.DoubleStream;
# The class java.lang.ProcessHandle is new to 1.9
cat << \EOF > conftest.java
-// #line 12942 "configure"
+// #line 12943 "configure"
import java.util.regex.Pattern;
import java.lang.ProcessHandle;
# jgraphx
cat << \EOF > conftestSharedChecker.java
-// #line 14440 "configure"
+// #line 14441 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 14641 "configure"
+// #line 14642 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 14877 "configure"
+// #line 14878 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 15119 "configure"
+// #line 15120 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 15353 "configure"
+// #line 15354 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 15587 "configure"
+// #line 15588 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 15822 "configure"
+// #line 15823 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 16056 "configure"
+// #line 16057 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 16396 "configure"
+// #line 16397 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 16687 "configure"
+// #line 16688 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 16919 "configure"
+// #line 16920 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 17154 "configure"
+// #line 17155 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 17388 "configure"
+// #line 17389 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 17622 "configure"
+// #line 17623 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 17856 "configure"
+// #line 17857 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 18087 "configure"
+// #line 18088 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 18322 "configure"
+// #line 18323 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 18558 "configure"
+// #line 18559 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 18794 "configure"
+// #line 18795 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 19035 "configure"
+// #line 19036 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 19269 "configure"
+// #line 19270 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 19503 "configure"
+// #line 19504 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 19737 "configure"
+// #line 19738 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 19971 "configure"
+// #line 19972 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 20206 "configure"
+// #line 20207 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 20440 "configure"
+// #line 20441 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 20675 "configure"
+// #line 20676 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 20909 "configure"
+// #line 20910 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 21143 "configure"
+// #line 21144 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 21377 "configure"
+// #line 21378 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 21611 "configure"
+// #line 21612 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 21849 "configure"
+// #line 21850 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 22083 "configure"
+// #line 22084 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 22317 "configure"
+// #line 22318 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 22557 "configure"
+// #line 22558 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 22791 "configure"
+// #line 22792 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 23025 "configure"
+// #line 23026 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 23259 "configure"
+// #line 23260 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 23490 "configure"
+// #line 23491 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 23728 "configure"
+// #line 23729 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 23959 "configure"
+// #line 23960 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 24194 "configure"
+// #line 24195 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 24428 "configure"
+// #line 24429 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 24659 "configure"
+// #line 24660 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 24893 "configure"
+// #line 24894 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
# Provided by time.h
-for ac_func in nanosleep gettimeofday
+for ac_func in gettimeofday nanosleep
do :
as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Eigen is version $CHK_EIGEN_WORLD.$CHK_EIGEN_MAJOR.$CHK_EIGEN_MINOR or later" >&5
$as_echo_n "checking if Eigen is version $CHK_EIGEN_WORLD.$CHK_EIGEN_MAJOR.$CHK_EIGEN_MINOR or later... " >&6; }
cat > conftest.$ac_ext <<EOF
-#line 29294 "configure"
+#line 29296 "configure"
#include "confdefs.h"
#include "$PATH_TO_EIGEN/Eigen/Sparse"
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if tcl is version $CHK_TCL_MAJOR.$CHK_TCL_MINOR or later" >&5
$as_echo_n "checking if tcl is version $CHK_TCL_MAJOR.$CHK_TCL_MINOR or later... " >&6; }
cat > conftest.$ac_ext <<EOF
-#line 33971 "configure"
+#line 33973 "configure"
#include "confdefs.h"
#include "$CHK_TCL_INCLUDE_PATH/$CHK_TCL_INC_NAME"
$as_echo_n "checking if tk is version $CHK_TK_MAJOR.$CHK_TK_MINOR or later... " >&6; }
cat > conftest.$ac_ext <<EOF
-#line 34282 "configure"
+#line 34284 "configure"
#include "confdefs.h"
#include "$CHK_TK_INCLUDE_PATH/$CHK_TK_INC_NAME"
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 34872 "configure"
+// #line 34874 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 35104 "configure"
+// #line 35106 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
if test ! -f conftestSharedChecker.class ; then
cat << \EOF > conftestSharedChecker.java
-// #line 35337 "configure"
+// #line 35339 "configure"
import java.util.regex.Pattern;
import java.io.File;
import java.io.IOException;
DEBUG_CXXFLAGS="-DNDEBUG -g1 -O2"
fi
COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -fno-stack-protector " # bug 3131
+ COMPILER_CXXFLAGS="$COMPILER_CXXFLAGS -lstdc++fs" # required on Ubuntu
;;
esac
src/c/removedir.c \
src/c/cluni0.c \
src/c/scicurdir.c \
- src/c/fullpath.c \
src/c/fileinfo.c \
src/c/getrelativefilename.c \
src/c/splitpath.c \
FILEIO_CPP_SOURCES = \
src/cpp/expandPathVariable.cpp \
src/cpp/filemanager_interface.cpp \
+ src/cpp/fullpath.cpp \
src/cpp/mopen.cpp \
src/cpp/mclose.cpp \
src/cpp/mput.cpp \
src/c/libscifileio_algo_la-removedir.lo \
src/c/libscifileio_algo_la-cluni0.lo \
src/c/libscifileio_algo_la-scicurdir.lo \
- src/c/libscifileio_algo_la-fullpath.lo \
src/c/libscifileio_algo_la-fileinfo.lo \
src/c/libscifileio_algo_la-getrelativefilename.lo \
src/c/libscifileio_algo_la-splitpath.lo \
src/c/libscifileio_algo_la-convert_tools.lo
am__objects_2 = src/cpp/libscifileio_algo_la-expandPathVariable.lo \
src/cpp/libscifileio_algo_la-filemanager_interface.lo \
+ src/cpp/libscifileio_algo_la-fullpath.lo \
src/cpp/libscifileio_algo_la-mopen.lo \
src/cpp/libscifileio_algo_la-mclose.lo \
src/cpp/libscifileio_algo_la-mput.lo \
src/c/$(DEPDIR)/libscifileio_algo_la-findfiles.Plo \
src/c/$(DEPDIR)/libscifileio_algo_la-fprintfMat.Plo \
src/c/$(DEPDIR)/libscifileio_algo_la-fscanfMat.Plo \
- src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo \
src/c/$(DEPDIR)/libscifileio_algo_la-getFullFilename.Plo \
src/c/$(DEPDIR)/libscifileio_algo_la-getdrives.Plo \
src/c/$(DEPDIR)/libscifileio_algo_la-getlongpathname.Plo \
src/cpp/$(DEPDIR)/libscifileio_algo_la-expandPathVariable.Plo \
src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager.Plo \
src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager_interface.Plo \
+ src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo \
src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiledesc.Plo \
src/cpp/$(DEPDIR)/libscifileio_algo_la-getfileinfo.Plo \
src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiletype.Plo \
src/c/removedir.c \
src/c/cluni0.c \
src/c/scicurdir.c \
- src/c/fullpath.c \
src/c/fileinfo.c \
src/c/getrelativefilename.c \
src/c/splitpath.c \
FILEIO_CPP_SOURCES = \
src/cpp/expandPathVariable.cpp \
src/cpp/filemanager_interface.cpp \
+ src/cpp/fullpath.cpp \
src/cpp/mopen.cpp \
src/cpp/mclose.cpp \
src/cpp/mput.cpp \
src/c/$(DEPDIR)/$(am__dirstamp)
src/c/libscifileio_algo_la-scicurdir.lo: src/c/$(am__dirstamp) \
src/c/$(DEPDIR)/$(am__dirstamp)
-src/c/libscifileio_algo_la-fullpath.lo: src/c/$(am__dirstamp) \
- src/c/$(DEPDIR)/$(am__dirstamp)
src/c/libscifileio_algo_la-fileinfo.lo: src/c/$(am__dirstamp) \
src/c/$(DEPDIR)/$(am__dirstamp)
src/c/libscifileio_algo_la-getrelativefilename.lo: \
src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
src/cpp/libscifileio_algo_la-filemanager_interface.lo: \
src/cpp/$(am__dirstamp) src/cpp/$(DEPDIR)/$(am__dirstamp)
+src/cpp/libscifileio_algo_la-fullpath.lo: src/cpp/$(am__dirstamp) \
+ src/cpp/$(DEPDIR)/$(am__dirstamp)
src/cpp/libscifileio_algo_la-mopen.lo: src/cpp/$(am__dirstamp) \
src/cpp/$(DEPDIR)/$(am__dirstamp)
src/cpp/libscifileio_algo_la-mclose.lo: src/cpp/$(am__dirstamp) \
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-findfiles.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-fprintfMat.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-fscanfMat.Plo@am__quote@ # am--include-marker
-@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-getFullFilename.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-getdrives.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/c/$(DEPDIR)/libscifileio_algo_la-getlongpathname.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-expandPathVariable.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager_interface.Plo@am__quote@ # am--include-marker
+@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiledesc.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-getfileinfo.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__include@ @am__quote@src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiletype.Plo@am__quote@ # am--include-marker
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscifileio_algo_la-scicurdir.lo `test -f 'src/c/scicurdir.c' || echo '$(srcdir)/'`src/c/scicurdir.c
-src/c/libscifileio_algo_la-fullpath.lo: src/c/fullpath.c
-@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscifileio_algo_la-fullpath.lo -MD -MP -MF src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Tpo -c -o src/c/libscifileio_algo_la-fullpath.lo `test -f 'src/c/fullpath.c' || echo '$(srcdir)/'`src/c/fullpath.c
-@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Tpo src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='src/c/fullpath.c' object='src/c/libscifileio_algo_la-fullpath.lo' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o src/c/libscifileio_algo_la-fullpath.lo `test -f 'src/c/fullpath.c' || echo '$(srcdir)/'`src/c/fullpath.c
-
src/c/libscifileio_algo_la-fileinfo.lo: src/c/fileinfo.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT src/c/libscifileio_algo_la-fileinfo.lo -MD -MP -MF src/c/$(DEPDIR)/libscifileio_algo_la-fileinfo.Tpo -c -o src/c/libscifileio_algo_la-fileinfo.lo `test -f 'src/c/fileinfo.c' || echo '$(srcdir)/'`src/c/fileinfo.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) src/c/$(DEPDIR)/libscifileio_algo_la-fileinfo.Tpo src/c/$(DEPDIR)/libscifileio_algo_la-fileinfo.Plo
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscifileio_algo_la-filemanager_interface.lo `test -f 'src/cpp/filemanager_interface.cpp' || echo '$(srcdir)/'`src/cpp/filemanager_interface.cpp
+src/cpp/libscifileio_algo_la-fullpath.lo: src/cpp/fullpath.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscifileio_algo_la-fullpath.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Tpo -c -o src/cpp/libscifileio_algo_la-fullpath.lo `test -f 'src/cpp/fullpath.cpp' || echo '$(srcdir)/'`src/cpp/fullpath.cpp
+@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Tpo src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='src/cpp/fullpath.cpp' object='src/cpp/libscifileio_algo_la-fullpath.lo' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+@am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o src/cpp/libscifileio_algo_la-fullpath.lo `test -f 'src/cpp/fullpath.cpp' || echo '$(srcdir)/'`src/cpp/fullpath.cpp
+
src/cpp/libscifileio_algo_la-mopen.lo: src/cpp/mopen.cpp
@am__fastdepCXX_TRUE@ $(AM_V_CXX)$(LIBTOOL) $(AM_V_lt) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libscifileio_algo_la_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT src/cpp/libscifileio_algo_la-mopen.lo -MD -MP -MF src/cpp/$(DEPDIR)/libscifileio_algo_la-mopen.Tpo -c -o src/cpp/libscifileio_algo_la-mopen.lo `test -f 'src/cpp/mopen.cpp' || echo '$(srcdir)/'`src/cpp/mopen.cpp
@am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) src/cpp/$(DEPDIR)/libscifileio_algo_la-mopen.Tpo src/cpp/$(DEPDIR)/libscifileio_algo_la-mopen.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-findfiles.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-fprintfMat.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-fscanfMat.Plo
- -rm -f src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-getFullFilename.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-getdrives.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-getlongpathname.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-expandPathVariable.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager_interface.Plo
+ -rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiledesc.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-getfileinfo.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiletype.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-findfiles.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-fprintfMat.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-fscanfMat.Plo
- -rm -f src/c/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-getFullFilename.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-getdrives.Plo
-rm -f src/c/$(DEPDIR)/libscifileio_algo_la-getlongpathname.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-expandPathVariable.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-filemanager_interface.Plo
+ -rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-fullpath.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiledesc.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-getfileinfo.Plo
-rm -f src/cpp/$(DEPDIR)/libscifileio_algo_la-getfiletype.Plo
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;FILEIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<PreLinkEvent>
<Message>Make dependencies</Message>
<PreprocessorDefinitions>_CRT_SECURE_NO_DEPRECATE;FORDLL;_DEBUG;_WINDOWS;_USRDLL;FILEIO_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<WarningLevel>Level3</WarningLevel>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<PreLinkEvent>
<Message>Make dependencies</Message>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4723</DisableSpecificWarnings>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<PreLinkEvent>
<Message>Make dependencies</Message>
<WarningLevel>Level3</WarningLevel>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<DisableSpecificWarnings>4723</DisableSpecificWarnings>
+ <LanguageStandard>stdcpp17</LanguageStandard>
</ClCompile>
<PreLinkEvent>
<Message>Make dependencies</Message>
<ClCompile Include="src\cpp\addfile.cpp" />
<ClCompile Include="src\cpp\delfile.cpp" />
<ClCompile Include="src\cpp\filemanager_interface.cpp" />
+ <ClCompile Include="src\cpp\fullpath.cpp" />
<ClCompile Include="src\cpp\getfiledesc.cpp" />
<ClCompile Include="src\cpp\getfileinfo.cpp" />
<ClCompile Include="src\cpp\getfiletype.cpp" />
<ClCompile Include="src\c\findfiles.c" />
<ClCompile Include="src\c\fprintfMat.c" />
<ClCompile Include="src\c\fscanfMat.c" />
- <ClCompile Include="src\c\fullpath.c" />
<ClCompile Include="src\c\getdrives.c" />
<ClCompile Include="src\c\getFullFilename.c" />
<ClCompile Include="src\c\getlongpathname.c" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
-</Project>
+</Project>
\ No newline at end of file
<ClCompile Include="src\c\fscanfMat.c">
<Filter>Source Files</Filter>
</ClCompile>
- <ClCompile Include="src\c\fullpath.c">
- <Filter>Source Files</Filter>
- </ClCompile>
<ClCompile Include="src\c\getdrives.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="src\cpp\filemanager_interface.cpp">
<Filter>Source Files</Filter>
</ClCompile>
+ <ClCompile Include="src\cpp\fullpath.cpp">
+ <Filter>Source Files</Filter>
+ </ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="includes\mgetl.h">
<Filter>Libraries Dependencies\Imports</Filter>
</None>
</ItemGroup>
-</Project>
+</Project>
\ No newline at end of file
* @return returns a pointer to a buffer containing the absolute path name (absPath).
*/
-FILEIO_IMPEXP char * get_full_path(char * _FullPath, const char * _Path, size_t _SizeInBytes);
+FILEIO_IMPEXP char * get_full_path(const char * _Path);
/**
* Creates an absolute or full path name for the specified relative path name.
* @return returns a pointer to a buffer containing the absolute path name (absPath).
* "localized" on windows (Wide char)
*/
-FILEIO_IMPEXP wchar_t * get_full_pathW(wchar_t * _wcFullPath, const wchar_t * _wcPath, size_t _SizeInBytes);
+FILEIO_IMPEXP wchar_t * get_full_pathW(const wchar_t * _wcPath);
#endif
/*--------------------------------------------------------------------------*/
/*
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
* Copyright (C) 2011 - 2011 - DIGITEO - Bruno JOFRET
- *
* Copyright (C) 2012 - 2016 - Scilab Enterprises
+ * Copyright (C) 2019 - Stéphane Mottelet
*
* This file is hereby licensed under the terms of the GNU GPL v2.0,
* pursuant to article 5.3.4 of the CeCILL v.2.1.
return types::Function::Error;
}
- char fullpath[PATH_MAX * 4];
types::String* pIn = in[0]->getAs<types::String>();
types::String* pOut = new types::String(pIn->getDims(), pIn->getDimsArray());
for (int i = 0 ; i < pIn->getSize() ; i++)
{
- char *relPath = wide_string_to_UTF8(pIn->get(i));
- if ( get_full_path(fullpath, relPath, PATH_MAX * 4 ) != NULL)
- {
- pOut->set(i, fullpath);
- FREE(relPath);
- }
- else
- {
- Scierror(999, _("%s: Wrong value for input argument #%d: '%s' is an invalid path.\n"), "fullpath", 1, relPath);
- FREE(relPath);
- pOut->killMe();
- return types::Function::Error;
- }
-
- fullpath[0] = L'\0';
+ wchar_t *pwstFullPath = get_full_pathW(pIn->get(i));
+ pOut->set(i,pwstFullPath);
+ FREE (pwstFullPath);
}
out.push_back(pOut);
return types::Function::Error;
}
- wchar_t* pwstTemp = (wchar_t*)MALLOC(sizeof(wchar_t) * (PATH_MAX * 2));
- get_full_pathW(pwstTemp, (const wchar_t*)pstFilename, PATH_MAX * 2);
+ wchar_t* pwstTemp = get_full_pathW((const wchar_t*)pstFilename);
iErr = mopen(pwstTemp, pstMode, iSwap, &iID);
if (iErr != MOPEN_NO_ERROR)
{
char *pStrDest = wide_string_to_UTF8(DestinationFilename);
char *pStrSrc = wide_string_to_UTF8(SourceFilename);
- char strDestFullPath[PATH_MAX * 2 + 1];
- char strSrcFullPath[PATH_MAX * 2 + 1];
-
int sfd = -1;
int dfd = -1;
struct stat st;
int nread = 0, nwritten = 0;
int status = 0;
- get_full_path(strDestFullPath, pStrDest, PATH_MAX * 2);
- get_full_path(strSrcFullPath, pStrSrc, PATH_MAX * 2);
+ char *strDestFullPath = get_full_path(pStrDest);
+ char *strSrcFullPath = get_full_path(pStrSrc);
if (strcmp(strDestFullPath, strSrcFullPath) == 0)
{
status = EPERM;
+ FREE(strSrcFullPath);
+ FREE(strDestFullPath);
goto err;
}
+ FREE(strSrcFullPath);
+ FREE(strDestFullPath);
+
if ((sfd = open (pStrSrc, O_RDONLY, 0)) < 0)
{
status = errno;
+++ /dev/null
-/*
-* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
-* Copyright (C) 2009-2011 - DIGITEO - Allan CORNET
-*
- * Copyright (C) 2012 - 2016 - Scilab Enterprises
- *
- * This file is hereby licensed under the terms of the GNU GPL v2.0,
- * pursuant to article 5.3.4 of the CeCILL v.2.1.
- * This file was originally licensed under the terms of the CeCILL v2.1,
- * and continues to be available under such terms.
- * For more information, see the COPYING file which you should have received
- * along with this program.
-*
-*/
-/*--------------------------------------------------------------------------*/
-#include <string.h>
-#include <stdlib.h>
-#include <stdio.h>
-#ifndef _MSC_VER
-#include <sys/param.h>
-#include <limits.h>
-#endif
-#include "fullpath.h"
-#include "charEncoding.h"
-#include "sci_malloc.h"
-#include "machine.h"
-#include "PATH_MAX.h"
-#include "strsubst.h"
-#include "scicurdir.h"
-#include "expandPathVariable.h"
-/*--------------------------------------------------------------------------*/
-#ifndef _MSC_VER
-static unsigned int isDirSeparator(const char c);
-static int normalizePath(char *path);
-#endif
-/*--------------------------------------------------------------------------*/
-char *get_full_path(char *_FullPath, const char *_Path, size_t _SizeInBytes)
-{
-#if defined(_MSC_VER)
- char *returnedFullPath = NULL;
-
- wchar_t *wPath = to_wide_string((char *)_Path);
- wchar_t *wFullPath = (wchar_t *) MALLOC(sizeof(wchar_t) * _SizeInBytes);
-
- get_full_pathW(wFullPath, wPath, _SizeInBytes);
- returnedFullPath = wide_string_to_UTF8(wFullPath);
- if (returnedFullPath)
- {
- strcpy(_FullPath, returnedFullPath);
- FREE(returnedFullPath);
- returnedFullPath = NULL;
- }
-
- if (wPath)
- {
- FREE(wPath);
- wPath = NULL;
- }
- if (wFullPath)
- {
- FREE(wFullPath);
- wFullPath = NULL;
- }
-
- return _FullPath;
-#else
- char *rp = NULL;
- int lenPath = (int)strlen(_Path);
- int lenFullPath = 0;
- int haveFileSep = ((lenPath > 1) && isDirSeparator(_Path[lenPath - 1]));
- int addFileSep = 0;
-
- rp = realpath(_Path, _FullPath);
- lenFullPath = (int)strlen(_FullPath);
-
- if (rp == NULL)
- {
- char * tofind;
- char * toadd;
- char * _Path_tmp;
- char * _Path_start;
- char * _FullPath_start;
- char* pstWorkingPath = NULL;
-
- //if argument is a relative path, add currentdir at start
- if (_Path[0] != '/')
- {
- int ierr = 0;
- char* pstCurrentPath = scigetcwd(&ierr);
- //alloc buffer + 2, 1 for '/' and 1 for null termination
- pstWorkingPath = (char*)CALLOC(sizeof(char), (lenPath + strlen(pstCurrentPath) + 2));
- sprintf(pstWorkingPath, "%s/%s", pstCurrentPath, _Path);
- lenPath = strlen(pstWorkingPath);
- FREE(pstCurrentPath);
- }
- else
- {
- pstWorkingPath = strdup(_Path);
- }
-
- _Path_tmp = (char *)MALLOC(sizeof(char) * (lenPath + 1));
- _Path_start = (char *)MALLOC(sizeof(char) * (lenPath + 1));
- _FullPath_start = (char *)MALLOC(sizeof(char) * (lenFullPath + 1));
-
- //First case(1): fullpath(TMPDIR+"/a/b/c"), second case(2): fullpath("a/b/c") or third case(3): fullpath("../a/b")
- strcpy(_Path_start, pstWorkingPath); // _Path_start=TMPDIR+"/a/b/c" (1) or _Path_start="a/b/c" (2) or _Path_start="../a/b/c" (3)
- strcpy(_FullPath_start, _FullPath); // _Fullpath_Start=TMPDIR+"/a" (1) or _FullPath_start=SCI+"/a" (2) or _FullPath_start=../SCI+"/a" (3)
- strtok(_Path_start, "/"); // _Path_start=/tmp (1) or _Path_start="a" (2) or _Path_start="a/b/c" (3)
- strtok(_FullPath_start, "/"); // _FullPath_start=/tmp (1) or _FullPath_start=/home (2) and (3)
-
- if (strcmp(_Path_start, _FullPath_start) == 0) // For case: fullpath(TMPDIR+"/a/b/c") (1)
- {
- strcpy(_FullPath, pstWorkingPath);
- normalizePath(_FullPath);
- }
- else if (strcmp(_Path, _FullPath) != 0) // For case: fullpath("a/b/c") (2) or fullpath("../a/b/c") (3)
- {
- strcpy(_Path_tmp, pstWorkingPath); //_Path_tmp="a/b/c" (2) or _Path_tmp="../a/b/c" (3)
- strtok(_Path_tmp, "./"); // _Path_tmp becomes a (2) or ../a (3)
- toadd = strsub(pstWorkingPath, _Path_tmp, ""); // to add = "/b/c"
- strcat(_FullPath, toadd); //_FullPath=_Fullpath+toadd
- FREE(toadd);
- }
-
- FREE(pstWorkingPath);
- FREE(_FullPath_start);
- FREE(_Path_start);
- FREE(_Path_tmp);
- }
-
- lenFullPath = (int)strlen(_FullPath);
- addFileSep = ((lenFullPath > 1) && (!isDirSeparator(_FullPath[lenFullPath - 1])) && haveFileSep);
- if (addFileSep)
- {
- char *bufTmp = (char *)MALLOC(sizeof(char) * (lenFullPath + strlen(DIR_SEPARATOR) + 1));
- if (bufTmp)
- {
- sprintf(bufTmp, "%s%s", _FullPath, DIR_SEPARATOR);
- strcpy(_FullPath, bufTmp);
- FREE(bufTmp);
- bufTmp = NULL;
- }
- }
-
- return _FullPath;
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-wchar_t *get_full_pathW(wchar_t * _wcFullPath, const wchar_t * _wcPath, size_t _SizeInBytes)
-{
-#if defined(_MSC_VER)
- if (_wcPath)
- {
- wchar_t* pwstExpand = expandPathVariableW(_wcPath);
- _wfullpath(_wcFullPath, pwstExpand, _SizeInBytes);
- FREE(pwstExpand);
- return _wcFullPath;
- }
- return NULL;
-#else
- if (_wcPath)
- {
- char *_Path = wide_string_to_UTF8(_wcPath);
- if (_Path)
- {
- char *_FullPath = (char *)MALLOC(sizeof(char) * (_SizeInBytes));
-
- if (_FullPath)
- {
- wchar_t *wcResult = NULL;
- char *rp = NULL;
-
- rp = realpath(_Path, _FullPath);
- if (!rp)
- {
- strcpy(_FullPath, _Path);
- normalizePath(_FullPath);
- }
- wcResult = to_wide_string(_FullPath);
- FREE(_FullPath);
- if (wcResult)
- {
- wcscpy(_wcFullPath, wcResult);
- FREE(wcResult);
- }
- }
- FREE(_Path);
- }
- }
- return _wcFullPath;
-#endif
-}
-
-/*--------------------------------------------------------------------------*/
-#ifndef _MSC_VER
-static unsigned int isDirSeparator(const char c)
-{
- return (c == '/' || c == '\\');
-}
-/*--------------------------------------------------------------------------*/
-static int normalizePath(char *path)
-{
- char *dirs[PATH_MAX];
- int depth = 0;
- char *dstptr = path;
- char *srcptr = path;
-
- dirs[0] = path;
- depth++;
-
- while (1)
- {
- if ((srcptr[0] == '.') && isDirSeparator(srcptr[1]))
- {
- /* ./ */
- srcptr += 2;
- }
- else if (srcptr[0] == '.' && srcptr[1] == '.' && isDirSeparator(srcptr[2]))
- {
- /* ../ */
- if (depth == 1)
- {
- /* ../ */
- dstptr[0] = '.';
- dstptr[1] = '.';
- dstptr[2] = DIR_SEPARATOR[0];
- dstptr += 3;
- srcptr += 3;
- dirs[0] = dstptr;
- }
- else
- {
- /* a/b/../c */
- depth--;
- dstptr = dirs[depth - 1];
- srcptr += 3;
- }
- }
- else if (srcptr[0] == '.' && srcptr[1] == '.' && srcptr[2] == 0)
- {
- /* .. */
- if (depth == 1)
- {
- dstptr[0] = '.';
- dstptr[1] = '.';
- dstptr += 2;
- srcptr += 2;
- dirs[0] = dstptr;
- }
- else
- {
- depth--;
- dstptr = dirs[depth - 1];
- srcptr += 2;
- }
- }
- else
- {
- while (!isDirSeparator(srcptr[0]) && srcptr[0])
- {
- *dstptr++ = *srcptr++;
- }
-
- if (srcptr[0] == 0)
- {
- if (dstptr != path && isDirSeparator(dstptr[-1]))
- {
- dstptr[-1] = 0;
- }
- dstptr[0] = 0;
- return 0;
- }
- else if (isDirSeparator(srcptr[0]))
- {
- *dstptr++ = *srcptr++;
- dirs[depth] = dstptr;
- depth++;
- /* // */
- while (isDirSeparator(srcptr[0]) && srcptr[0])
- {
- srcptr++;
- }
- }
- else
- {
- /* error */
- return -1;
- }
- }
- }
-}
-#endif
-/*--------------------------------------------------------------------------*/
}
}
- wcTmp = (wchar_t*)MALLOC(sizeof(wchar_t) * (PATH_MAX * 2));
if (wcTmp)
{
- get_full_pathW(wcTmp, (const wchar_t*)wcPath, PATH_MAX * 2);
+ wcTmp = get_full_pathW((const wchar_t*)wcPath);
wcscpy(wcPath, wcTmp);
FREE(wcTmp);
wcTmp = NULL;
--- /dev/null
+/*
+* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+* Copyright (C) 2019-2011 - Stéphane MOTTELET
+*
+ *
+ * This file is hereby licensed under the terms of the GNU GPL v2.0,
+ * pursuant to article 5.3.4 of the CeCILL v.2.1.
+ * This file was originally licensed under the terms of the CeCILL v2.1,
+ * and continues to be available under such terms.
+ * For more information, see the COPYING file which you should have received
+ * along with this program.
+*
+*/
+/*--------------------------------------------------------------------------*/
+
+#include <filesystem>
+
+extern "C"
+{
+#include "charEncoding.h"
+#include "fullpath.h"
+#include "sci_malloc.h"
+#include "os_string.h"
+}
+
+char *get_full_path(const char *_Path)
+{
+#ifdef _MSC_VER
+ char *_FullPath = NULL;
+ wchar_t *wFullPath = NULL;
+ wchar_t *wPath = to_wide_string((char *)_Path);
+
+ if (wPath)
+ {
+ wFullPath = get_full_pathW(wPath);
+ FREE(wPath);
+ if (wFullPath)
+ {
+ _FullPath = wide_string_to_UTF8(wFullPath);
+ FREE(wFullPath);
+ }
+ }
+ return _FullPath;
+#else // POSIX
+ std::filesystem::path relPath = std::filesystem::path(_Path);
+ std::filesystem::path canonPath = std::filesystem::weakly_canonical(relPath);
+ auto relPathIt = relPath.end();
+ auto canonPathIt = canonPath.end();
+ if ((--relPathIt)->string().empty() && !(--canonPathIt)->string().empty())
+ {
+ canonPath /= "";
+ }
+ return os_strdup(std::filesystem::absolute(canonPath).string().c_str());
+#endif // _MSC_VER
+}
+
+/*--------------------------------------------------------------------------*/
+wchar_t *get_full_pathW(const wchar_t * _wcPath)
+{
+#ifdef _MSC_VER
+ std::filesystem::path relPath = std::filesystem::path(_wcPath);
+ std::filesystem::path canonPath = std::filesystem::weakly_canonical(relPath);
+ auto relPathIt = relPath.end();
+ auto canonPathIt = canonPath.end();
+ if ((--relPathIt)->wstring().empty() && !(--canonPathIt)->wstring().empty())
+ {
+ canonPath /= "";
+ }
+ return os_wcsdup(std::filesystem::absolute(canonPath).wstring().c_str());
+#else // POSIX
+ char *_FullPath = NULL;
+ wchar_t *wFullPath = NULL;
+ char *_Path = wide_string_to_UTF8(_wcPath);
+
+ if (_Path)
+ {
+ _FullPath = get_full_path(_Path);
+ FREE(_Path);
+ if (_FullPath)
+ {
+ wFullPath = to_wide_string(_FullPath);
+ FREE(_FullPath);
+ }
+ }
+ return wFullPath;
+#endif // _MSC_VER
+}
+
+
--- /dev/null
+// =============================================================================
+// Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
+// Copyright (C) 2019 - Stéphane MOTTELET
+//
+// This file is distributed under the same license as the Scilab package.
+// =============================================================================
+//
+// <-- CLI SHELL MODE -->
+// <-- NO CHECK REF -->
+//
+// <-- Non-regression test for bug 16149 -->
+//
+// <-- Bugzilla URL -->
+// https://bugzilla.scilab.org/show_bug.cgi?id=16149
+//
+// <-- Short Description -->
+// fullpath does not support symbolic links
+
+cd(TMPDIR)
+mkdir("testdir")
+if getos() <> "Windows" then
+ unix_w("ln -sf "+TMPDIR+"/testdir tmp");
+else
+ host("mklink /D tmp "+TMPDIR+"\testdir");
+end
+
+// symbolic link
+assert_checkequal(fullpath("tmp/hello.txt"),strcat([TMPDIR "testdir" "hello.txt"], filesep()));
+
+// symbolic link (recursive)
+assert_checkequal(fullpath("tmp/../tmp/hello.txt"),strcat([TMPDIR "testdir" "hello.txt"], filesep()));
+
+// delete the symbolic link
+if getos() <> "Windows" then
+ deletefile("tmp");
+else
+ host("rmdir tmp");
+end
+
+// raw path when tmp is not a symbolic link
+assert_checkequal(fullpath("tmp/hello.txt"),strcat([TMPDIR "tmp" "hello.txt"], filesep()));
+assert_checkequal(fullpath("tmp/../tmp/hello.txt"),strcat([TMPDIR "tmp" "hello.txt"], filesep()));
+assert_checkequal(fullpath("tmp/tmp/../../hello.txt"),strcat([TMPDIR "hello.txt"], filesep()));
+
FREE(pstFile);
- wchar_t* pwstTemp = (wchar_t*)MALLOC(sizeof(wchar_t) * (PATH_MAX * 2));
- get_full_pathW(pwstTemp, pwstFile, PATH_MAX * 2);
+ wchar_t* pwstTemp = get_full_pathW(pwstFile);
wstFile = pwstTemp;
FREE(pwstFile);
int SetUicontrolIcon(void* _pvCtx, int iObjUID, void* _pvData, int valueType, int nbRow, int nbCol)
{
char* expandedpath = NULL;
- char absolutepath[4096];
+ char *absolutepath = NULL;
if (valueType != sci_strings)
{
char* iconPath = org_scilab_modules_commons_gui::FindIconHelper::findIcon(getScilabJavaVM(), (char*)_pvData, 0);
if (iconPath == NULL)
{
- get_full_path(absolutepath, expandedpath, 4096);
+ absolutepath = get_full_path(expandedpath);
//it is a absolute path, put it only in model
if (strcmp(expandedpath, absolutepath))
if (setGraphicObjectProperty(iObjUID, __GO_UI_ICON__, absolutepath, jni_string, 1) == FALSE)
{
+ FREE(absolutepath);
Scierror(999, _("'%s' property does not exist for this handle.\n"), "icon");
return SET_PROPERTY_ERROR;
}
+ FREE(absolutepath);
return SET_PROPERTY_SUCCEED;
}
/*------------------------------------------------------------------------*/
expanded = false;
}
- wchar_t* pwstTemp = (wchar_t*)MALLOC(sizeof(wchar_t) * (PATH_MAX * 2));
- get_full_pathW(pwstTemp, pwstPathLib, PATH_MAX * 2);
+ wchar_t* pwstTemp = get_full_pathW(pwstPathLib);
FREE(pwstPathLib);
std::wstring SLint::getFullPath(const std::wstring & path)
{
const unsigned SIZE = PATH_MAX * 4;
- wchar_t * fullpath = (wchar_t *)MALLOC(SIZE * sizeof(wchar_t));
wchar_t * expandedPath = expandPathVariableW(const_cast<wchar_t *>(path.c_str()));
std::wstring _fullpath;
- if (get_full_pathW(fullpath, expandedPath, SIZE))
+
+ wchar_t * fullpath = get_full_pathW(expandedPath);
+
+ if (fullpath)
{
FREE(expandedPath);
_fullpath = std::wstring(fullpath);