tPlumb.app: handle spaces in file names (Rob Pike) - plan9port - [fork] Plan 9 from user space
(HTM) git clone git://src.adamsgaard.dk/plan9port
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) commit ff262e102983021abc2223e83131eea1f7eb5d58
(DIR) parent cbcec5adb9cb2274f3c4e2f3a8f4926b2e9689e8
(HTM) Author: Russ Cox <rsc@swtch.com>
Date: Fri, 28 Jan 2011 17:17:01 -0500
Plumb.app: handle spaces in file names (Rob Pike)
R=rsc
http://codereview.appspot.com/4113042
Diffstat:
M mac/Plumb.app/Contents/MacOS/plumb | 10 +++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/mac/Plumb.app/Contents/MacOS/plumb b/mac/Plumb.app/Contents/MacOS/plumb
t@@ -1,4 +1,12 @@
#!/bin/bash
. ~/.bashrc
PLAN9=${PLAN9:-/usr/local/plan9}
-$PLAN9/bin/plumb $($PLAN9/bin/macargv)
+filename="$($PLAN9/bin/macargv)"
+# Blank are problematic in the file name. Make them go away but keep the content.
+if echo "$filename" | grep -q " "
+then
+ base=$(basename "$filename" | sed 's/ /_/g')
+ cat "$filename" | plumb -i -d edit -a "action=showdata filename=/BadName/$base"
+else
+ $PLAN9/bin/plumb -d edit "$filename"
+fi