blob: 51d58ab37642910b80071e6a658ea144e2ca5dea (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use std::path::PathBuf;
use anyhow::Result;
use crate::task::{run_task, Project};
pub mod handle;
pub use handle::handle;
impl Project {
/// Return the stored neorg path of this project.
/// The returned path will never start with a slash (/).
pub(super) fn get_neorg_path(&self) -> Result<PathBuf> {
let project_path = run_task(&[
"_get",
format!("rc.context.{}.rc.neorg_path", self.to_context_display()).as_str(),
])?;
let final_path = project_path
.strip_prefix('/')
.unwrap_or(project_path.as_str());
Ok(PathBuf::from(final_path))
}
}
|