diff options
| author | Henil Dedania <dedaniahenil@gmail.com> | 2021-01-21 12:04:29 +0530 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-01-21 12:04:29 +0530 |
| commit | c32b837df772cbfb53ccd3b5434aefcbe7aaaf0b (patch) | |
| tree | bf74330c49e1f230a2693632a1db2c94a6309f6e /src/layout.rs | |
| parent | fix(main): do not hang on exit (#150) (diff) | |
| download | sl0ppij-c32b837df772cbfb53ccd3b5434aefcbe7aaaf0b.tar.gz sl0ppij-c32b837df772cbfb53ccd3b5434aefcbe7aaaf0b.tar.xz sl0ppij-c32b837df772cbfb53ccd3b5434aefcbe7aaaf0b.zip | |
feat(plugin): Search in root folder for plugins and layout files
Diffstat (limited to 'src/layout.rs')
| -rw-r--r-- | src/layout.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/layout.rs b/src/layout.rs index 2935d42d..d09e7618 100644 --- a/src/layout.rs +++ b/src/layout.rs @@ -1,6 +1,8 @@ +use crate::utils::consts::MOSAIC_ROOT_LAYOUT_DIR; use directories_next::ProjectDirs; use serde::{Deserialize, Serialize}; -use std::{fs::File, io::prelude::*, path::PathBuf}; +use std::path::{Path, PathBuf}; +use std::{fs::File, io::prelude::*}; use crate::panes::PositionAndSize; @@ -182,9 +184,11 @@ impl Layout { pub fn new(layout_path: PathBuf) -> Self { let project_dirs = ProjectDirs::from("org", "Mosaic Contributors", "Mosaic").unwrap(); let layout_dir = project_dirs.data_dir().join("layouts/"); + let root_layout_dir = Path::new(MOSAIC_ROOT_LAYOUT_DIR); let mut layout_file = File::open(&layout_path) .or_else(|_| File::open(&layout_path.with_extension("yaml"))) .or_else(|_| File::open(&layout_dir.join(&layout_path).with_extension("yaml"))) + .or_else(|_| File::open(root_layout_dir.join(&layout_path).with_extension("yaml"))) .unwrap_or_else(|_| panic!("cannot find layout {}", &layout_path.display())); let mut layout = String::new(); |
