mirror of
https://github.com/sbrow/envr.git
synced 2026-06-27 18:48:33 -04:00
wip: "full" findr
Creating direct equivilant of fd for performance testing, before reducing scope to needed features.
This commit is contained in:
@@ -230,6 +230,12 @@ process_dir :: proc(pool: ^WalkerPool, item: WorkItem) {
|
||||
}
|
||||
|
||||
if is_dir {
|
||||
if should_emit && matches_pattern(pool, entry.name) {
|
||||
dir_path_out := join_path_dir(dir_path, entry.name)
|
||||
sync.mutex_lock(&pool.results_mutex)
|
||||
append(pool.results, dir_path_out)
|
||||
sync.mutex_unlock(&pool.results_mutex)
|
||||
}
|
||||
if !ignored {
|
||||
child_rel, _ := strings.clone(entry_rel)
|
||||
child_path := join_path(dir_path, entry.name)
|
||||
@@ -367,3 +373,19 @@ join_path :: proc(parent, child: string) -> string {
|
||||
result, _ := strings.clone(s)
|
||||
return result
|
||||
}
|
||||
|
||||
join_path_dir :: proc(parent, child: string) -> string {
|
||||
b: strings.Builder
|
||||
strings.builder_init(&b)
|
||||
defer strings.builder_destroy(&b)
|
||||
|
||||
fmt.sbprintf(&b, "%s", parent)
|
||||
if len(parent) == 0 || parent[len(parent) - 1] != '/' {
|
||||
fmt.sbprintf(&b, "/")
|
||||
}
|
||||
fmt.sbprintf(&b, "%s/", child)
|
||||
|
||||
s := strings.to_string(b)
|
||||
result, _ := strings.clone(s)
|
||||
return result
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user