comparison libinterp/corefcn/ls-mat5.cc @ 32080:e9fdfebc6db0

Avoid using file_stat in libinterp/corefcn (bug #59711). * dirfnc.cc (F__mkdir__), file-io.cc (do_stream_open), graphics.cc (Fdrawnow), interpreter.cc (interpreter::execute_startup_files), load-path.cc (load_path::find_file, load_path::find_dir, load_path::find_matching_dirs, load_path::find_first_of, load_path::find_all_first_of, load_path::execute_pkg_add_or_del, load_path::add, load_path::find_private_file, load_path::dir_info::get_file_list, load_path::dir_info::get_method_file_map, genpath), load-save.cc (find_file_to_load), ls-mat5.cc (read_mat5_binary_element), urlwrite (Furlwrite), utils.cc (find_data_file_in_load_path, fcn_file_in_path), __ftp__.cc (F__ftp_mput__), __magick_read__.cc (F__magick_write__): Use functions "dir_exists" or "file_exists" instead of "file_stat".
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 06 May 2023 13:08:38 +0200
parents 610a85b0ff62
children 2f3b54f81947 2e484f9f1f18
comparison
equal deleted inserted replaced
32079:b0785d76430a 32080:e9fdfebc6db0
42 #include "data-conv.h" 42 #include "data-conv.h"
43 #include "file-ops.h" 43 #include "file-ops.h"
44 #include "file-stat.h" 44 #include "file-stat.h"
45 #include "glob-match.h" 45 #include "glob-match.h"
46 #include "lo-mappers.h" 46 #include "lo-mappers.h"
47 #include "lo-sysdep.h"
47 #include "mach-info.h" 48 #include "mach-info.h"
48 #include "oct-env.h" 49 #include "oct-env.h"
49 #include "oct-locbuf.h" 50 #include "oct-locbuf.h"
50 #include "oct-time.h" 51 #include "oct-time.h"
51 #include "quit.h" 52 #include "quit.h"
895 896
896 // First check if just replacing matlabroot is enough 897 // First check if just replacing matlabroot is enough
897 std::string str 898 std::string str
898 = (octave::config::octave_exec_home () 899 = (octave::config::octave_exec_home ()
899 + fpath.substr (mroot.length ())); 900 + fpath.substr (mroot.length ()));
900 octave::sys::file_stat fs (str); 901
901 902 if (octave::sys::file_exists (str))
902 if (fs.exists ())
903 { 903 {
904 std::size_t xpos 904 std::size_t xpos
905 = str.find_last_of (octave::sys::file_ops::dir_sep_chars ()); 905 = str.find_last_of (octave::sys::file_ops::dir_sep_chars ());
906 906
907 std::string dir_name = str.substr (0, xpos); 907 std::string dir_name = str.substr (0, xpos);