Skip to content

Commit 10c63e1

Browse files
committed
Update src/main.rs
1 parent f5ebbb6 commit 10c63e1

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/main.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ impl State {
3636
fn switch_session_with_cwd(&self, dir: &Path) -> Result<(), String> {
3737
let session_name = dir.file_name().unwrap().to_str().unwrap();
3838
let cwd = dir.to_path_buf();
39-
let layout_path = dir.to_str().unwrap().to_string() + "/layout.kdl";
40-
let host_layout_path = ROOT.to_string() + layout_path.as_str();
41-
let layout = if PathBuf::from(host_layout_path.clone()).exists() {
42-
LayoutInfo::File(host_layout_path)
39+
let host_layout_path = PathBuf::from(ROOT)
40+
.join(dir.strip_prefix("/").unwrap())
41+
.join("layout.kdl");
42+
let layout = if host_layout_path.exists() {
43+
LayoutInfo::File(host_layout_path.to_str().unwrap().into())
4344
} else {
4445
self.config.layout.clone()
4546
};

0 commit comments

Comments
 (0)