aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authora-kenji <aks.kenji@protonmail.com>2021-04-29 08:56:46 +0200
committera-kenji <aks.kenji@protonmail.com>2021-04-29 18:00:55 +0200
commit153119de021880a9b2d0a3f76cff430ccb8ab112 (patch)
treee5239766246663961e8a3c34b67d4f89f82d558d /src
parentchore(changelog): added the ability to synchronize input sent to panes (diff)
downloadsl0ppij-153119de021880a9b2d0a3f76cff430ccb8ab112.tar.gz
sl0ppij-153119de021880a9b2d0a3f76cff430ccb8ab112.tar.xz
sl0ppij-153119de021880a9b2d0a3f76cff430ccb8ab112.zip
Fix Startup with Default in Same Folder
Doesn't try loading `default` files, other than the plugin directory by default anymore.
Diffstat (limited to 'src')
-rw-r--r--src/client/layout.rs12
-rw-r--r--src/common/mod.rs4
2 files changed, 14 insertions, 2 deletions
diff --git a/src/client/layout.rs b/src/client/layout.rs
index e28058ba..ca1adb4d 100644
--- a/src/client/layout.rs
+++ b/src/client/layout.rs
@@ -205,6 +205,18 @@ impl Layout {
layout
}
+ // It wants to use Path here, but that doesn't compile.
+ #[warn(clippy::ptr_arg)]
+ pub fn from_defaults(layout_path: &PathBuf, data_dir: &Path) -> Self {
+ Self::new(
+ &data_dir
+ .join("layouts/")
+ .join(layout_path)
+ .with_extension("yaml"),
+ &data_dir,
+ )
+ }
+
pub fn total_terminal_panes(&self) -> usize {
let mut total_panes = 0;
total_panes += self.parts.len();
diff --git a/src/common/mod.rs b/src/common/mod.rs
index 0a04e3ff..ef518053 100644
--- a/src/common/mod.rs
+++ b/src/common/mod.rs
@@ -186,8 +186,8 @@ pub fn start(mut os_input: Box<dyn OsApi>, opts: CliArgs) {
let default_layout = None;
let maybe_layout = opts
.layout
- .or(default_layout)
- .map(|p| Layout::new(&p, &data_dir));
+ .map(|p| Layout::new(&p, &data_dir))
+ .or_else(|| default_layout.map(|p| Layout::from_defaults(&p, &data_dir)));
#[cfg(not(test))]
std::panic::set_hook({