]> git.lizzy.rs Git - plan9front.git/commitdiff
B: expand path when plumbing files
authorOri Bernstein <ori@eigenstate.org>
Sat, 12 Jun 2021 18:03:26 +0000 (18:03 +0000)
committerOri Bernstein <ori@eigenstate.org>
Sat, 12 Jun 2021 18:03:26 +0000 (18:03 +0000)
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.

rc/bin/B

index 866242438319e84d6d05016da5254f825c1c0376..c5666aa28b6de262d91ce4c90d52ac6ccbeb7c1d 100755 (executable)
--- a/rc/bin/B
+++ b/rc/bin/B
@@ -10,10 +10,9 @@ if(~ $#* 0){
        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]