Mercurial > octave
annotate liboctave/util/oct-glob.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 | 597f3ee61a48 |
children | b0785d76430a |
rev | line source |
---|---|
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
1 //////////////////////////////////////////////////////////////////////// |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
2 // |
31706
597f3ee61a48
update Octave Project Developers copyright for the new year
John W. Eaton <jwe@octave.org>
parents:
31607
diff
changeset
|
3 // Copyright (C) 2010-2023 The Octave Project Developers |
27923
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
4 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
5 // See the file COPYRIGHT.md in the top-level directory of this |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
6 // distribution or <https://octave.org/copyright/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
7 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
8 // This file is part of Octave. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
9 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
10 // Octave is free software: you can redistribute it and/or modify it |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
11 // under the terms of the GNU General Public License as published by |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
12 // the Free Software Foundation, either version 3 of the License, or |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
13 // (at your option) any later version. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
14 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
15 // Octave is distributed in the hope that it will be useful, but |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
16 // WITHOUT ANY WARRANTY; without even the implied warranty of |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
17 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
18 // GNU General Public License for more details. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
19 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
20 // You should have received a copy of the GNU General Public License |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
21 // along with Octave; see the file COPYING. If not, see |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
22 // <https://www.gnu.org/licenses/>. |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
23 // |
bd51beb6205e
update formatting of copyright notices
John W. Eaton <jwe@octave.org>
parents:
27919
diff
changeset
|
24 //////////////////////////////////////////////////////////////////////// |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
25 |
21724
aba2e6293dd8
use "#if ..." consistently instead of "#ifdef" and "#ifndef"
John W. Eaton <jwe@octave.org>
parents:
21301
diff
changeset
|
26 #if defined (HAVE_CONFIG_H) |
21301
40de9f8f23a6
Use '#include "config.h"' rather than <config.h>.
Rik <rik@octave.org>
parents:
21202
diff
changeset
|
27 # include "config.h" |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
28 #endif |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
29 |
10345
33b012d39dce
Convert between back and forward slashes before and after calling glob.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10314
diff
changeset
|
30 #include <algorithm> |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
31 #include <string> |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
32 |
21929
7ab7cd327257
hide fnmatch.h and glob.h headers
John W. Eaton <jwe@octave.org>
parents:
21761
diff
changeset
|
33 #include "glob-wrappers.h" |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
34 |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
35 #include "oct-glob.h" |
28898
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
36 #include "file-ops.h" |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
37 #include "file-stat.h" |
21929
7ab7cd327257
hide fnmatch.h and glob.h headers
John W. Eaton <jwe@octave.org>
parents:
21761
diff
changeset
|
38 #include "unwind-prot.h" |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
39 |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
40 #if defined (OCTAVE_USE_WINDOWS_API) |
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
41 # include <windows.h> |
29073
f39e75f35e48
__wglob__: Fix some issues with native implementation on Windows.
Markus Mützel <markus.muetzel@gmx.de>
parents:
28898
diff
changeset
|
42 # include <shlwapi.h> |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
43 # include <wchar.h> |
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
44 |
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
45 # include "lo-sysdep.h" |
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
46 #endif |
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
47 |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
48 // These functions are defined here and not in glob_match.cc so that we |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
49 // can include the glob.h file from gnulib, which defines glob to |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
50 // be rpl_glob. If we include glob.h in glob_match.cc, then it |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
51 // transforms the glob_match::glob function to be glob_match::rpl_glob, |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
52 // which is not what we want... |
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
53 |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
54 OCTAVE_BEGIN_NAMESPACE(octave) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
55 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
56 OCTAVE_BEGIN_NAMESPACE(sys) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
57 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
58 bool |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
59 fnmatch (const string_vector& pat, const std::string& str, int fnm_flags) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
60 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
61 int npat = pat.numel (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
62 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
63 const char *cstr = str.c_str (); |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
64 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
65 for (int i = 0; i < npat; i++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
66 if (octave_fnmatch_wrapper (pat(i).c_str (), cstr, fnm_flags) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
67 != octave_fnm_nomatch_wrapper ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
68 return true; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
69 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
70 return false; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
71 } |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
72 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
73 string_vector |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
74 glob (const string_vector& pat) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
75 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
76 string_vector retval; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
77 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
78 int npat = pat.numel (); |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
79 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
80 int k = 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
81 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
82 void *glob_info = octave_create_glob_info_struct (); |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
83 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
84 unwind_action cleanup_glob_info_struct |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
85 ([=] () { octave_destroy_glob_info_struct (glob_info); }); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
86 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
87 for (int i = 0; i < npat; i++) |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
88 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
89 std::string xpat = pat(i); |
21929
7ab7cd327257
hide fnmatch.h and glob.h headers
John W. Eaton <jwe@octave.org>
parents:
21761
diff
changeset
|
90 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
91 if (! xpat.empty ()) |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
92 { |
22197
e43d83253e28
refill multi-line macro definitions
John W. Eaton <jwe@octave.org>
parents:
22155
diff
changeset
|
93 #if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
94 && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
95 std::replace (xpat.begin (), xpat.end (), '\\', '/'); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
96 #endif |
10345
33b012d39dce
Convert between back and forward slashes before and after calling glob.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10314
diff
changeset
|
97 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
98 int err = octave_glob_wrapper (xpat.c_str (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
99 octave_glob_nosort_wrapper (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
100 glob_info); |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
101 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
102 if (! err) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
103 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
104 int n = octave_glob_num_matches (glob_info); |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
105 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
106 const char *const *matches |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
107 = octave_glob_match_list (glob_info); |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
108 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
109 // FIXME: we shouldn't have to check to see if |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
110 // a single match exists, but it seems that glob() won't |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
111 // check for us unless the pattern contains globbing |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
112 // characters. Hmm. |
10138
805a83ecd3da
avoid conflict between glob.h definition of glob and glob_match::glob function
John W. Eaton <jwe@octave.org>
parents:
diff
changeset
|
113 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
114 if (n > 1 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
115 || (n == 1 |
32078
632f9b828de1
Avoid using file_stat in liboctave/util (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31706
diff
changeset
|
116 && sys::file_exists (std::string (matches[0])))) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
117 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
118 retval.resize (k+n); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
119 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
120 for (int j = 0; j < n; j++) |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
121 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
122 std::string tmp = matches[j]; |
10345
33b012d39dce
Convert between back and forward slashes before and after calling glob.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10314
diff
changeset
|
123 |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
124 #if defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ |
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
125 && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
126 std::replace (tmp.begin (), tmp.end (), '/', '\\'); |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
127 #endif |
10345
33b012d39dce
Convert between back and forward slashes before and after calling glob.
Michael Goffioul <michael.goffioul@gmail.com>
parents:
10314
diff
changeset
|
128 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
129 retval[k++] = tmp; |
11586
12df7854fa7c
strip trailing whitespace from source files
John W. Eaton <jwe@octave.org>
parents:
11523
diff
changeset
|
130 } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
131 } |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
132 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
133 octave_globfree_wrapper (glob_info); |
10314
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10138
diff
changeset
|
134 } |
07ebe522dac2
untabify liboctave C++ sources
John W. Eaton <jwe@octave.org>
parents:
10138
diff
changeset
|
135 } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
136 } |
21726
f05a00e611ff
use namespace for glob and fnmatch wrapper functions
John W. Eaton <jwe@octave.org>
parents:
21724
diff
changeset
|
137 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
138 return retval.sort (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
139 } |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
140 |
28898
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
141 #if defined (OCTAVE_USE_WINDOWS_API) |
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
142 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
143 static void |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
144 find_files (std::list<std::string>& dirlist, const std::string& dir, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
145 const std::string& pat, std::string& file) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
146 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
147 // remove leading file separators |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
148 bool is_file_empty = file.empty (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
149 while (! file.empty () && sys::file_ops::is_dir_sep (file[0])) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
150 file = file.substr (1, std::string::npos); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
151 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
152 bool is_trailing_file_sep = ! is_file_empty && file.empty (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
153 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
154 if (! pat.compare (".") || ! pat.compare ("..")) |
28898
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
155 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
156 // shortcut for trivial patterns that would expand to a folder name |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
157 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
158 // get next component of path (or file name) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
159 std::size_t sep_pos |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
160 = file.find_first_of (sys::file_ops::dir_sep_chars ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
161 std::string pat_str = file.substr (0, sep_pos); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
162 std::string file_str = (sep_pos != std::string::npos) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
163 ? file.substr (sep_pos) : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
164 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
165 // Original pattern ends with "." or "..". Take it as we have it. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
166 if (pat_str.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
167 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
168 if (is_trailing_file_sep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
169 pat_str = sys::file_ops::dir_sep_char (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
170 dirlist.push_back (sys::file_ops::concat (dir, pat) + pat_str); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
171 return; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
172 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
173 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
174 // call this function recursively with next path component in PAT |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
175 find_files (dirlist, sys::file_ops::concat (dir, pat), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
176 pat_str, file_str); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
177 return; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
178 } |
31016
8475b51b990c
__wglob__: Retain trailing file separator on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30979
diff
changeset
|
179 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
180 // find first file in directory that matches pattern in PAT |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
181 std::wstring wpat = u8_to_wstring (sys::file_ops::concat (dir, pat)); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
182 _WIN32_FIND_DATAW ffd; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
183 HANDLE h_find = FindFirstFileW (wpat.c_str (), &ffd); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
184 // ignore any error |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
185 if (h_find == INVALID_HANDLE_VALUE) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
186 return; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
187 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
188 unwind_action close_h_find ([=] () { FindClose (h_find); }); |
31016
8475b51b990c
__wglob__: Retain trailing file separator on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30979
diff
changeset
|
189 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
190 // find all files that match pattern |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
191 do |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
192 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
193 // must be directory if pattern continues |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
194 if (! (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
195 && (! file.empty () || is_trailing_file_sep)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
196 continue; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
197 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
198 std::string found_dir = u8_from_wstring (ffd.cFileName); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
199 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
200 if (file.empty ()) |
30979
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
201 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
202 // Don't include "." and ".." in matches. |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
203 if (found_dir.compare (".") && found_dir.compare ("..")) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
204 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
205 if (is_trailing_file_sep) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
206 found_dir += sys::file_ops::dir_sep_char (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
207 dirlist.push_back (sys::file_ops::concat (dir, found_dir)); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
208 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
209 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
210 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
211 { |
30979
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
212 // get next component of path (or file name) |
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
213 std::size_t sep_pos |
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
214 = file.find_first_of (sys::file_ops::dir_sep_chars ()); |
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
215 std::string pat_str = file.substr (0, sep_pos); |
31016
8475b51b990c
__wglob__: Retain trailing file separator on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30979
diff
changeset
|
216 std::string file_str = (sep_pos != std::string::npos) |
8475b51b990c
__wglob__: Retain trailing file separator on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30979
diff
changeset
|
217 ? file.substr (sep_pos) : ""; |
8475b51b990c
__wglob__: Retain trailing file separator on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30979
diff
changeset
|
218 |
30979
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
219 // call this function recursively with next path component in PAT |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
220 find_files (dirlist, sys::file_ops::concat (dir, found_dir), |
30979
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
221 pat_str, file_str); |
302faf5bc425
__wglob__: Correctly handle "." and ".." in patterns on Windows (bug #62414).
Markus Mützel <markus.muetzel@gmx.de>
parents:
30564
diff
changeset
|
222 } |
28898
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
223 } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
224 while (FindNextFileW (h_find, &ffd) != 0); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
225 } |
28898
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
226 |
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
227 #endif |
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
228 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
229 // Glob like Windows "dir". Treat only * and ? as wildcards, |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
230 // and "*.*" matches filenames even if they do not contain ".". |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
231 string_vector |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
232 windows_glob (const string_vector& pat) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
233 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
234 string_vector retval; |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
235 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
236 int npat = pat.numel (); |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
237 |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
238 #if defined (OCTAVE_USE_WINDOWS_API) |
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
239 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
240 std::list<std::string> dirlist; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
241 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
242 for (int i = 0; i < npat; i++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
243 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
244 std::string xpat = pat(i); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
245 if (xpat.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
246 continue; |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
247 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
248 std::string dir = ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
249 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
250 // separate component until first file separator |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
251 std::size_t sep_pos |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
252 = xpat.find_first_of (sys::file_ops::dir_sep_chars ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
253 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
254 // handle UNC paths |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
255 if (sep_pos == 0 && xpat.length () > 1 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
256 && sys::file_ops::is_dir_sep (xpat[1])) |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
257 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
258 // start pattern with a file, i.e., "\\SERVER\share\file" |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
259 sep_pos = xpat.find_first_of (sys::file_ops::dir_sep_chars (), 2); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
260 if (sep_pos != std::string::npos) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
261 sep_pos = xpat.find_first_of (sys::file_ops::dir_sep_chars (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
262 sep_pos + 1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
263 if (sep_pos != std::string::npos) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
264 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
265 dir = xpat.substr(0, sep_pos); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
266 xpat = xpat.substr (sep_pos+1); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
267 sep_pos = xpat.find_first_of (sys::file_ops::dir_sep_chars ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
268 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
269 } |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
270 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
271 std::string file = (sep_pos != std::string::npos) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
272 ? xpat.substr (sep_pos) : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
273 xpat = xpat.substr (0, sep_pos); |
31065
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
274 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
275 if ((sep_pos == 2 || xpat.length () == 2) && xpat[1] == ':') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
276 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
277 // include disc root with first file or folder |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
278 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
279 // remove leading file separators in path without disc root |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
280 while (file.length () > 1 && sys::file_ops::is_dir_sep (file[0])) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
281 file = file.substr (1, std::string::npos); |
31065
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
282 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
283 sep_pos = file.find_first_of (sys::file_ops::dir_sep_chars ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
284 dir = xpat; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
285 xpat = file.substr (0, sep_pos); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
286 file = (sep_pos != std::string::npos) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
287 ? file.substr (sep_pos) : ""; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
288 if (xpat.empty ()) |
31065
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
289 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
290 // don't glob if input is only disc root |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
291 std::wstring wpat = u8_to_wstring (pat(i)); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
292 if (PathFileExistsW (wpat.c_str ())) |
31065
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
293 { |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
294 if (sys::file_ops::is_dir_sep (pat(i).back ())) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
295 dirlist.push_back (dir + |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
296 sys::file_ops::dir_sep_char ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
297 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
298 dirlist.push_back (dir); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
299 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
300 continue; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
301 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
302 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
303 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
304 find_files (dirlist, dir, xpat, file); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
305 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
306 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
307 retval = string_vector (dirlist); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
308 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
309 #else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
310 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
311 int k = 0; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
312 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
313 void *glob_info = octave_create_glob_info_struct (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
314 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
315 unwind_action cleanup_glob_info_struct |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
316 ([=] () { octave_destroy_glob_info_struct (glob_info); }); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
317 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
318 for (int i = 0; i < npat; i++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
319 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
320 std::string xpat = pat(i); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
321 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
322 if (! xpat.empty ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
323 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
324 std::string escaped; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
325 escaped.reserve (xpat.length ()); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
326 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
327 for (std::size_t j = 0; j < xpat.length (); j++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
328 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
329 # if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
330 && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
331 if (xpat[j] == '\\') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
332 escaped += '/'; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
333 else |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
334 # endif |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
335 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
336 if (xpat[j] == ']' || xpat[j] == '[') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
337 escaped += '\\'; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
338 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
339 escaped += xpat[j]; |
31065
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
340 } |
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
341 } |
d33af4594440
__wglob__: Handle patterns with UNC paths on Windows (bug #62576).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31027
diff
changeset
|
342 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
343 // Replace trailing "*.*" by "*". |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
344 int len = escaped.length (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
345 if (len >= 3 && escaped.substr (len - 3) == "*.*") |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
346 escaped = escaped.substr (0, len - 2); |
28898
caf577e7ef43
__wglob__: Fix for argument containing directory (bug #59252).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28869
diff
changeset
|
347 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
348 int err = octave_glob_wrapper (escaped.c_str (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
349 octave_glob_nosort_wrapper (), |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
350 glob_info); |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
351 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
352 if (! err) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
353 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
354 int n = octave_glob_num_matches (glob_info); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
355 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
356 const char *const *matches |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
357 = octave_glob_match_list (glob_info); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
358 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
359 // FIXME: we shouldn't have to check to see if |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
360 // a single match exists, but it seems that glob() won't |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
361 // check for us unless the pattern contains globbing |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
362 // characters. Hmm. |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
363 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
364 if (n > 1 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
365 || (n == 1 |
32078
632f9b828de1
Avoid using file_stat in liboctave/util (bug #59711).
Markus Mützel <markus.muetzel@gmx.de>
parents:
31706
diff
changeset
|
366 && sys::file_exists (std::string (matches[0])))) |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
367 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
368 retval.resize (k + n); |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
369 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
370 for (int j = 0; j < n; j++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
371 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
372 std::string tmp = matches[j]; |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
373 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
374 std::string unescaped; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
375 unescaped.reserve (tmp.length ()); |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
376 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
377 for (std::size_t m = 0; m < tmp.length (); m++) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
378 { |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
379 # if (defined (OCTAVE_HAVE_WINDOWS_FILESYSTEM) \ |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
380 && ! defined (OCTAVE_HAVE_POSIX_FILESYSTEM)) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
381 if (tmp[m] == '/') |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
382 unescaped += '\\'; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
383 else |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
384 # endif |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
385 { |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
386 if (tmp[m] == '\\' |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
387 && ++m == tmp.length ()) |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
388 break; |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
389 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
390 unescaped += tmp[m]; |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
391 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
392 } |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
393 |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
394 retval[k++] = unescaped; |
22402
4caa7b28d183
maint: Style check C++ code in liboctave/
Rik <rik@octave.org>
parents:
22323
diff
changeset
|
395 } |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
396 } |
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
397 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
398 octave_globfree_wrapper (glob_info); |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
399 } |
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
400 } |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
401 } |
28869
4e64416772f1
Use Windows wide character API for __wglob__ (bug #59231).
Markus Mützel <markus.muetzel@gmx.de>
parents:
28857
diff
changeset
|
402 #endif |
22155
289409b2992d
Allow dir to accept [ and ] in arguments. (bug #47950)
Lachlan Andrew <lachlanbis@gmail.com>
parents:
21929
diff
changeset
|
403 |
31607
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
404 return retval.sort (); |
aac27ad79be6
maint: Re-indent code after switch to using namespace macros.
Rik <rik@octave.org>
parents:
31605
diff
changeset
|
405 } |
31605
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
406 |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
407 OCTAVE_END_NAMESPACE(sys) |
e88a07dec498
maint: Use macros to begin/end C++ namespaces.
Rik <rik@octave.org>
parents:
31065
diff
changeset
|
408 OCTAVE_END_NAMESPACE(octave) |