-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from TC999/dev1
忽略测试
- Loading branch information
Showing
4 changed files
with
57 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,5 @@ Cargo.lock | |
/target | ||
|
||
# 日志文件 | ||
*.log | ||
*.log | ||
adcignore.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use std::collections::HashSet; | ||
use std::fs::{self, OpenOptions}; | ||
use std::io::{self, BufRead, Write}; | ||
use std::path::Path; | ||
|
||
const IGNORE_FILE: &str = "adcignore.txt"; | ||
|
||
pub fn load_ignored_folders() -> HashSet<String> { | ||
let mut ignored = HashSet::new(); | ||
if let Ok(file) = fs::File::open(IGNORE_FILE) { | ||
for line in io::BufReader::new(file).lines().flatten() { | ||
ignored.insert(line); | ||
} | ||
} | ||
ignored | ||
} | ||
|
||
pub fn save_ignored_folders(ignored: &HashSet<String>) { | ||
if let Ok(mut file) = OpenOptions::new().write(true).create(true).truncate(true).open(IGNORE_FILE) { | ||
for folder in ignored { | ||
writeln!(file, "{}", folder).unwrap(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters