changeset 23125:ef0909c445df

pkg: also search .cpp an .cxx files for PKG directives (bug #50199) * pkg/private/install.m: Also search .cpp nad .cxx files for PKG directives. Use glob instead of dir to find files.
author John W. Eaton <jwe@octave.org>
date Tue, 31 Jan 2017 17:42:29 -0500
parents 9e54152e382b
children 2eb7d330eb7f
files scripts/pkg/private/install.m
diffstat 1 files changed, 7 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/pkg/private/install.m	Fri Jan 20 21:40:11 2017 +0100
+++ b/scripts/pkg/private/install.m	Tue Jan 31 17:42:29 2017 -0500
@@ -711,16 +711,19 @@
 
   if (archfid >= 0 && instfid >= 0)
     ## Search all dot-m files for PKG commands.
-    lst = dir (fullfile (packdir, "inst", "*.m"));
+    lst = glob (fullfile (packdir, "inst", "*.m"));
     for i = 1:length (lst)
-      nam = fullfile (packdir, "inst", lst(i).name);
+      nam = lst{i};
       fwrite (instfid, extract_pkg (nam, ['^[#%][#%]* *' nm ': *(.*)$']));
     endfor
 
     ## Search all C++ source files for PKG commands.
-    lst = dir (fullfile (packdir, "src", "*.cc"));
+    cc_lst = glob (fullfile (packdir, "src", "*.cc"));
+    cpp_lst = glob (fullfile (packdir, "src", "*.cpp"));
+    cxx_lst = glob (fullfile (packdir, "src", "*.cxx"));
+    lst = [cc_lst; cpp_lst; cxx_lst];
     for i = 1:length (lst)
-      nam = fullfile (packdir, "src", lst(i).name);
+      nam = lst{i};
       fwrite (archfid, extract_pkg (nam, ['^//* *' nm ': *(.*)$']));
       fwrite (archfid, extract_pkg (nam, ['^/\** *' nm ': *(.*) *\*/$']));
     endfor