shithub: plan9front

Download patch

ref: c12e49ecbf4ae7933b13d592543c9f7c7dc03581
parent: 1c30bd451e1813f1cf9f9db4d7c1a4f3f95d1e37
author: Ori Bernstein <ori@eigenstate.org>
date: Sat Jun 12 14:03:26 EDT 2021

B: expand path when plumbing files

When we plumb a file, we open it in the current working
directory if it exists. However, if it doesn't exist,
we end up opening it relative to the editor's working
directory.

Expanding the path to works around this issue.

--- a/rc/bin/B	Sat Jun 12 13:20:53 2021
+++ b/rc/bin/B	Sat Jun 12 14:03:26 2021
@@ -10,10 +10,9 @@
 	exit usage
 }
 
-if(test -f /mnt/plumb/edit || test -f /mnt/term/mnt/plumb/edit){
-	for(i)
-		plumb -s B -d edit $i
-	exit
+wdir=`{pwd}
+for(i){
+	if(! ~ $i /*)
+		i=$wdir/$i
+	plumb -s B -d edit $i
 }
-
-echo 'no plumber' >[1=2]