Mercurial > octave
comparison liboctave/util/url-transfer.cc @ 32078:632f9b828de1
Avoid using file_stat in liboctave/util (bug #59711).
* cmd-edit.cc (looks_like_filename), cmd-hist.cc (gnu_history::do_append),
kpse.cc (kpse_element_dir), oct-glob.cc (glob, windows_glob),
url-transfer.cc (base_url_transfer::mget_directory): Use functions "dir_exists"
or "file_exists" instead of "file_stat".
* kpse.cc (dir_p), oct-glob.cc (single_match_exists): Remove unused static
functions.
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sat, 06 May 2023 10:56:33 +0200 |
parents | 9cd7515e735d |
children | 943a95892df0 |
comparison
equal
deleted
inserted
replaced
32077:ed3a18fe328a | 32078:632f9b828de1 |
---|---|
73 void | 73 void |
74 base_url_transfer::mget_directory (const std::string& directory, | 74 base_url_transfer::mget_directory (const std::string& directory, |
75 const std::string& target) | 75 const std::string& target) |
76 { | 76 { |
77 std::string sep = sys::file_ops::dir_sep_str (); | 77 std::string sep = sys::file_ops::dir_sep_str (); |
78 sys::file_stat fs (directory); | 78 |
79 | 79 if (! sys::dir_exists (directory)) |
80 if (! fs || ! fs.is_dir ()) | |
81 { | 80 { |
82 std::string msg; | 81 std::string msg; |
83 int status = sys::mkdir (directory, 0777, msg); | 82 int status = sys::mkdir (directory, 0777, msg); |
84 | 83 |
85 if (status < 0) | 84 if (status < 0) |
173 continue; | 172 continue; |
174 | 173 |
175 std::string realfile | 174 std::string realfile |
176 = realdir + sys::file_ops::dir_sep_str () + file; | 175 = realdir + sys::file_ops::dir_sep_str () + file; |
177 | 176 |
178 sys::file_stat fs (realfile); | 177 if (! sys::file_exists (realfile)) |
179 | |
180 if (! fs.exists ()) | |
181 { | 178 { |
182 m_ok = false; | 179 m_ok = false; |
183 m_errmsg = "__ftp__mput: file '" + realfile | 180 m_errmsg = "__ftp__mput: file '" + realfile |
184 + "' does not exist"; | 181 + "' does not exist"; |
185 break; | 182 break; |
186 } | 183 } |
187 | 184 |
188 if (fs.is_dir ()) | 185 if (sys::dir_exists (realfile)) |
189 { | 186 { |
190 file_list.append (mput_directory (realdir, file)); | 187 file_list.append (mput_directory (realdir, file)); |
191 | 188 |
192 if (! good ()) | 189 if (! good ()) |
193 break; | 190 break; |