changeset 29315:0fb5ba41a12a

Use "__wglob__" instead of "glob" on Windows (bug #49628). * delete.m, pkg/private/install.m: Use "__wglob__" instead of "glob" on Windows.
author Markus Mützel <markus.muetzel@gmx.de>
date Fri, 22 Jan 2021 17:13:01 +0100
parents 83fe13ca9ce3
children 2d26113ddf57
files scripts/miscellaneous/delete.m scripts/pkg/private/install.m
diffstat 2 files changed, 23 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/miscellaneous/delete.m	Thu Jan 21 19:37:19 2021 -0800
+++ b/scripts/miscellaneous/delete.m	Fri Jan 22 17:13:01 2021 +0100
@@ -47,7 +47,11 @@
 
   if (iscellstr (varargin))
     for arg = varargin
-      files = glob (arg{1});
+      if (ispc ())
+        files = __wglob__ (arg{1});
+      else
+        files = glob (arg{1});
+      endif
       if (isempty (files))
         warning ("Octave:delete:no-such-file", ...
                  "delete: no such file: %s", arg{1});
--- a/scripts/pkg/private/install.m	Thu Jan 21 19:37:19 2021 -0800
+++ b/scripts/pkg/private/install.m	Fri Jan 22 17:13:01 2021 +0100
@@ -52,18 +52,24 @@
     packages = local_packages;
   endif
 
+  if (ispc ())
+    oct_glob = @__wglob__;
+  else
+    oct_glob = @glob;
+  endif
+
   ## Uncompress the packages and read the DESCRIPTION files.
   tmpdirs = packdirs = descriptions = {};
   try
     ## Warn about non existent files.
     for i = 1:length (files)
-      if (isempty (glob (files{i})))
+      if (isempty (oct_glob (files{i})))
         warning ("file %s does not exist", files{i});
       endif
     endfor
 
     ## Unpack the package files and read the DESCRIPTION files.
-    files = glob (files);
+    files = oct_glob (files);
     packages_to_uninstall = [];
     for i = 1:length (files)
       tgz = files{i};
@@ -730,17 +736,23 @@
   endif
 
   if (archfid >= 0 && instfid >= 0)
+    if (ispc ())
+      oct_glob = @__wglob__;
+    else
+      oct_glob = @glob;
+    endif
+
     ## Search all dot-m files for PKG commands.
-    lst = glob (fullfile (packdir, "inst", "*.m"));
+    lst = oct_glob (fullfile (packdir, "inst", "*.m"));
     for i = 1:length (lst)
       nam = lst{i};
       fwrite (instfid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$']));
     endfor
 
     ## Search all C++ source files for PKG commands.
-    cc_lst = glob (fullfile (packdir, "src", "*.cc"));
-    cpp_lst = glob (fullfile (packdir, "src", "*.cpp"));
-    cxx_lst = glob (fullfile (packdir, "src", "*.cxx"));
+    cc_lst = oct_glob (fullfile (packdir, "src", "*.cc"));
+    cpp_lst = oct_glob (fullfile (packdir, "src", "*.cpp"));
+    cxx_lst = oct_glob (fullfile (packdir, "src", "*.cxx"));
     lst = [cc_lst; cpp_lst; cxx_lst];
     for i = 1:length (lst)
       nam = lst{i};