Skip to content

Commit

Permalink
fix: macos compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
SergioRibera committed Oct 19, 2024
1 parent 3a84bec commit f1c3f8e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
2 changes: 1 addition & 1 deletion crates/sss_code/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ fn main() -> Result<(), Report> {
ss.find_syntax_by_extension(ext)
.wrap_err("Extension not found from extension argument")?
} else {
ss.find_syntax_for_file(&content.filename())?
ss.find_syntax_for_file(content.filename())?
.wrap_err("Extension not found from stdin or file")?
};

Expand Down
6 changes: 5 additions & 1 deletion crates/sss_lib/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
use font_kit::error::{FontLoadingError, GlyphLoadingError, SelectionError};
use image::ImageError;
use notify_rust::{error::Error as NotificationError, ImageError as NotificationImageError};
use notify_rust::error::Error as NotificationError;
use std::num::ParseIntError;

#[cfg(all(unix, not(target_os = "macos")))]
use notify_rust::ImageError as NotificationImageError;

use thiserror::Error;

#[derive(Debug, Error)]
Expand All @@ -14,6 +17,7 @@ pub enum ImagenGeneration {
Font(#[from] FontError),
Image(#[from] ImageError),
Notification(#[from] NotificationError),
#[cfg(all(unix, not(target_os = "macos")))]
NotificationImage(#[from] NotificationImageError),
#[error("{0}")]
Custom(String),
Expand Down
6 changes: 3 additions & 3 deletions crates/sss_lib/src/out.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use image::codecs::png::PngEncoder;
use image::{ImageBuffer, ImageEncoder, Rgba};
use notify_rust::Notification;

#[cfg(target_os = "linux")]
#[cfg(all(unix, not(target_os = "macos")))]
use notify_rust::Image;

use crate::{error, str_to_format};
Expand Down Expand Up @@ -32,7 +32,7 @@ pub fn make_output(

if show_notify {
tracing::trace!("Show notification");
#[cfg(all(unix, not(target_os = "macos"), not(target_os = "windows")))]
#[cfg(all(unix, not(target_os = "macos")))]
Notification::new()
.summary("Image generated")
.body(&format!("Image stored in {output}"))
Expand All @@ -42,7 +42,7 @@ pub fn make_output(
img.to_vec(),
)?)
.show()?;
#[cfg(all(target_os = "macos", target_os = "windows"))]
#[cfg(all(not(unix), target_os = "macos"))]
Notification::new()
.summary("Image generated")
.body(&format!("Image stored in {output}"))
Expand Down

0 comments on commit f1c3f8e

Please sign in to comment.