Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F30988
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/rust/finder.rs b/rust/finder.rs
index 2e577c6..f3baa97 100644
--- a/rust/finder.rs
+++ b/rust/finder.rs
@@ -1,38 +1,39 @@
use ignore::{overrides::OverrideBuilder, WalkBuilder};
use std::fs;
pub struct Options {
pub directory: String,
}
pub fn find_files(options: Options) -> Vec<String> {
let mut files: Vec<String> = Vec::new();
let base_path = &fs::canonicalize(options.directory).unwrap();
let mut builder = WalkBuilder::new(base_path);
// Search for hidden files and directories
builder.hidden(false);
// Don't require a git repo to use .gitignore files. We want to use the .gitignore files
// wherever we are
builder.require_git(false);
// TODO(ade): Remove unwraps and find a good way to get the errors into the UI. Currently there
// is no way to handel errors in the rust library
let mut override_builder = OverrideBuilder::new("");
override_builder.add("!.git").unwrap();
+ override_builder.add("!.sl").unwrap();
let overrides = override_builder.build().unwrap();
builder.overrides(overrides);
for result in builder.build() {
let absolute_candidate = result.unwrap();
let candidate_path = absolute_candidate.path().strip_prefix(base_path).unwrap();
if candidate_path.is_dir() {
continue;
}
files.push(candidate_path.to_str().unwrap().to_string());
}
files
}
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Wed, Sep 10, 5:13 PM (9 h, 38 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
9040
Default Alt Text
(1 KB)
Attached To
Mode
R1 ivy.nvim
Attached
Detach File
Event Timeline
Log In to Comment