Skip to content

Commit

Permalink
feat(hierarchy): replace / with path separator
Browse files Browse the repository at this point in the history
  • Loading branch information
Ninjani committed Apr 14, 2021
1 parent bb9c9a2 commit c0e9156
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/gooseberry/knowledge_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,7 @@ impl Gooseberry {
let mut order_to_annotations = HashMap::new();
match order {
OrderBy::Tag => {
let path_separator = &std::path::MAIN_SEPARATOR.to_string();
for annotation in annotations {
if annotation.annotation.tags.is_empty() {
order_to_annotations
Expand All @@ -214,8 +215,9 @@ impl Gooseberry {
.push(annotation);
} else {
for tag in &annotation.annotation.tags {
let tag = tag.replace("/", path_separator);
order_to_annotations
.entry(tag.to_owned())
.entry(tag)
.or_insert_with(Vec::new)
.push(annotation.clone());
}
Expand Down Expand Up @@ -368,6 +370,7 @@ impl Gooseberry {
raw_annotations: inner_annotations,
};
// TODO: check if nested tags work on Windows
// TODO: add tests for nested tags
if let Some(prefix) = path.parent() {
fs::create_dir_all(prefix)?;
}
Expand Down

0 comments on commit c0e9156

Please sign in to comment.