Skip to content

Commit

Permalink
Cleaned up Theme loading folder location
Browse files Browse the repository at this point in the history
I forgot that as a temporary to get theme loading working I had it look
for a themes subdirectory off the executable's local dir. I need to move
the theme loading into the settings module, but as a quick patch to get
it looking in the correct directory I've made the get_dir from the
settings module public, and am using that.
  • Loading branch information
Vadoola committed Dec 12, 2023
1 parent 073838d commit e92f3e5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -520,7 +520,8 @@ fn main() -> Result<()> {
let load_theme_handle = main.as_weak();
main.global::<ThemeCallbacks>().on_load_themes(move || {
let load_theme_handle = load_theme_handle.unwrap();
let mut theme_dir = std::env::current_dir().unwrap();
//let mut theme_dir = std::env::current_dir().unwrap();
let mut theme_dir = std::path::PathBuf::from(settings::get_dir().unwrap());
theme_dir.push("themes");
let themes: Vec<JsonTheme> = {
//I'm thinking I need to move this into the settings modules maybe?
Expand Down
6 changes: 5 additions & 1 deletion src/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ pub struct GlobalShortcuts {
static CFG_DIR: OnceLock<Option<ProjectDirs>> = OnceLock::new();
static DEF_THEME: OnceLock<JsonThemeTemp> = OnceLock::new();

fn get_dir() -> Option<&'static Path> {
//This really probably shouldn't be public. But for now as a quick way to get the theme loading
//working from the correct directory I'm making it public. I need to move the theme loading
//from the main.rs file into the settings module, then I can make this private again
//fn get_dir() -> Option<&'static Path> {
pub fn get_dir() -> Option<&'static Path> {
if let Some(dirs) = CFG_DIR.get_or_init(|| ProjectDirs::from("org", "Vadoola", "Tomotroid")) {
return Some(dirs.config_dir());
} else {
Expand Down

0 comments on commit e92f3e5

Please sign in to comment.