Skip to content

Commit

Permalink
Test for default layer path
Browse files Browse the repository at this point in the history
  • Loading branch information
madig committed Mar 11, 2024
1 parent 0b9e433 commit 38cd349
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -237,11 +237,8 @@ impl LayerContents {
where
F: FnMut(&Layer) -> bool,
{
// Always keep the default layer, which is always the first.
let mut is_first = true;
self.layers.retain(|layer| {
if is_first {
is_first = false;
if layer.is_default() {
return true;
}
predicate(layer)
Expand Down Expand Up @@ -460,6 +457,14 @@ impl Layer {
self.glyphs.is_empty()
}

/// Returns `true` if this layer is the default layer.
///
/// The default layer can have any name, but always uses the "glyphs"
/// directory.
pub fn is_default(&self) -> bool {
self.path == Path::new(DEFAULT_GLYPHS_DIRNAME)
}

/// Returns the name of the layer.
///
/// This can only be mutated through the [`LayerContents`].
Expand Down

0 comments on commit 38cd349

Please sign in to comment.