use globfs
This commit is contained in:
46
package.cm
46
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user