Skip to content

Commit

Permalink
fix paths to embedded files
Browse files Browse the repository at this point in the history
  • Loading branch information
Luctins committed Feb 18, 2023
1 parent c4a6722 commit 1ddd33f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
9 changes: 3 additions & 6 deletions src/image_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,15 @@ use crate::*;

/*--- Const --------------------------------------------------------------------------------------*/


/*--- Impl ---------------------------------------------------------------------------------------*/

lazy_static!{
/// Supported file types
static ref ALLOWED_FILE_TYPES: HashSet<String> = vec![ "png", "jpg", "jpeg", "webp"]
.drain(..).map(|v| v.to_string()).collect();

static ref PLACEHOLDER_BUF: &'static [u8] =
std::include_bytes!("../assets/img/placeholder.bmp");
}

/*--- Impl ---------------------------------------------------------------------------------------*/


/// Image and file manager
pub struct ImageManager {
pub image_index: usize,
Expand Down
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,18 @@ use text_suggest::TextSuggester;
const LOCAL_CONFIG_FOLDER: &'static str = ".image-sorter";
const CONFIG_FILE_NAME: &'static str = "layout.json";

const DEFAULT_LAYOUT_S: &'static str = std::include_str!("../assets/cfg/layout.json.template");
pub const DEFAULT_LAYOUT_S: &'static str = std::include_str!("../config/layout.json.template");
pub const DEFAULT_CATEGORIES_S: &'static str =
std::include_str!("../config/categories.json.template");

pub const TAG_SEPARATOR: &'static str = "--";

lazy_static::lazy_static!{
static ref DEFAULT_LAYOUT: Config = json5::from_str(DEFAULT_LAYOUT_S)
.expect("failed to parse default configuration");

pub static ref PLACEHOLDER_BUF: &'static [u8] =
std::include_bytes!("../assets/placeholder.bmp");
}

/*--- Impl ---------------------------------------------------------------------------------------*/
Expand Down
3 changes: 1 addition & 2 deletions src/text_suggest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ pub const TAG_SEPARATOR: &'static str = "--";

pub const CATEGORIES_FILE_NAME: &'static str = "categories.json";

pub const DEFAULT_CATEGORIES_S: &'static str =
std::include_str!("../assets/cfg/categories.json.template");
pub use super::DEFAULT_CATEGORIES_S;

lazy_static::lazy_static!{
static ref DEFAULT_CATEGORIES:HashSet<String> = serde_json::from_str(DEFAULT_CATEGORIES_S)
Expand Down

0 comments on commit 1ddd33f

Please sign in to comment.