From 3e0dc1431857d187cb0e61151aec6bd7747edb3d Mon Sep 17 00:00:00 2001 From: John Alanbrook Date: Thu, 19 Feb 2026 00:43:06 -0600 Subject: [PATCH] use globfs --- package.cm | 46 +++++----------------------------------------- 1 file changed, 5 insertions(+), 41 deletions(-) diff --git a/package.cm b/package.cm index f7371a1f..61beb139 100644 --- a/package.cm +++ b/package.cm @@ -204,41 +204,8 @@ package.gather_dependencies = function(name) package.list_files = function(pkg) { var dir = get_path(pkg) - - var files = [] - - var walk = function(current_dir, current_prefix) { - var list = fd.readdir(current_dir) - if (!list) return - - var i = 0 - var item = null - var full_path = null - var rel_path = null - var st = null - for (i = 0; i < length(list); i++) { - item = list[i] - if (item == '.' || item == '..') continue - if (starts_with(item, '.')) continue - - // Skip build directories in root - - full_path = current_dir + "/" + item - rel_path = current_prefix ? current_prefix + "/" + item : item - - st = fd.stat(full_path) - if (st.isDirectory) { - walk(full_path, rel_path) - } else { - push(files, rel_path) - } - } - } - - if (fd.is_dir(dir)) { - walk(dir, "") - } - return files + if (!fd.is_dir(dir)) return [] + return fd.globfs(["*", "!.*"], dir) } package.list_modules = function(name) { @@ -386,12 +353,9 @@ package.get_c_files = function(name, target, exclude_main) { }) // Exclude src/ files (support files, not modules) - var sources = package.get_sources(name) - if (length(sources) > 0) { - result = filter(result, function(f) { - return find(sources, function(s) { return s == f }) == null - }) - } + result = filter(result, function(f) { + return !starts_with(f, 'src/') + }) return result }