better path resolution
This commit is contained in:
27
add.ce
27
add.ce
@@ -78,29 +78,6 @@ if (!fd.is_file(cwd + '/cell.toml')) {
|
||||
$stop()
|
||||
}
|
||||
|
||||
// Recursively find all cell packages in a directory
|
||||
function find_packages(dir) {
|
||||
var found = []
|
||||
var list = fd.readdir(dir)
|
||||
if (!list) return found
|
||||
if (fd.is_file(dir + '/cell.toml')) {
|
||||
push(found, dir)
|
||||
}
|
||||
arrfor(list, function(item) {
|
||||
if (item == '.' || item == '..' || item == '.cell' || item == '.git') return
|
||||
var full = dir + '/' + item
|
||||
var st = fd.stat(full)
|
||||
var sub = null
|
||||
if (st && st.isDirectory) {
|
||||
sub = find_packages(full)
|
||||
arrfor(sub, function(p) {
|
||||
push(found, p)
|
||||
})
|
||||
}
|
||||
})
|
||||
return found
|
||||
}
|
||||
|
||||
// If -r flag, find all packages recursively and add each
|
||||
if (recursive) {
|
||||
if (!locator) {
|
||||
@@ -111,7 +88,9 @@ if (recursive) {
|
||||
log.error(`${locator} is not a directory`)
|
||||
$stop()
|
||||
}
|
||||
locators = find_packages(resolved)
|
||||
locators = filter(pkg.find_packages(resolved), function(p) {
|
||||
return p != cwd
|
||||
})
|
||||
if (length(locators) == 0) {
|
||||
log.console("No packages found in " + resolved)
|
||||
$stop()
|
||||
|
||||
Reference in New Issue
Block a user