about summary refs log tree commit diff stats
path: root/pkgs/by-name
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-08 10:00:32 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-04-08 10:00:32 +0200
commit400c85af51aab6b34d1f2d61cd7607795dc9730f (patch)
tree735e0a43422948beabd63f8238ae59165e088827 /pkgs/by-name
parentfix(pkgs/tskm/open): Don't hardfail on unknown lock IP (diff)
downloadnixos-config-400c85af51aab6b34d1f2d61cd7607795dc9730f.zip
fix(pkgs/tskm/neorg): Avoid trying to write into `/index.norg`
Diffstat (limited to 'pkgs/by-name')
-rw-r--r--pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs9
1 files changed, 8 insertions, 1 deletions
diff --git a/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs b/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs
index dc5cdf19..51d58ab3 100644
--- a/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs
+++ b/pkgs/by-name/ts/tskm/src/interface/neorg/mod.rs
@@ -8,11 +8,18 @@ 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(),
         ])?;
-        Ok(PathBuf::from(project_path.as_str()))
+
+        let final_path = project_path
+            .strip_prefix('/')
+            .unwrap_or(project_path.as_str());
+
+        Ok(PathBuf::from(final_path))
     }
 }