[kupfer] Allow opening (sending to kupfer) files with a , in the name or path
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [kupfer] Allow opening (sending to kupfer) files with a , in the name or path
- Date: Sun, 14 Feb 2010 21:24:20 +0000 (UTC)
commit 540473aa45135f24ad6b6de64560824b051a282c
Author: Ulrik Sverdrup <ulrik sverdrup gmail com>
Date: Sun Feb 14 22:17:25 2010 +0100
Allow opening (sending to kupfer) files with a , in the name or path
bin/kupfer.in | 5 +++--
kupfer/ui/listen.py | 3 +++
2 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/bin/kupfer.in b/bin/kupfer.in
index f1c23c9..d3a4556 100755
--- a/bin/kupfer.in
+++ b/bin/kupfer.in
@@ -57,8 +57,9 @@ _realpaths () {
if test \( -n "$1" -a $KUPFER_HAS_OPTIONS != 0 \)
then
- # FIXME: How to handle files with , in filename
- ARRAY=$(_realpaths "$@" | tr \\0 ,)
+ # NOTE: We must escape commas here since it is dbus-send's
+ # array item separator. This is then unescaped by kupfer
+ ARRAY=$(_realpaths "$@" | sed -e 's/,/%%kupfercomma%%/g' | tr \\0 ,)
dbus-send --print-reply --dest=se.kaizer.kupfer /interface \
se.kaizer.kupfer.Listener.PutFiles array:string:"$ARRAY" \
>/dev/null 2>&1
diff --git a/kupfer/ui/listen.py b/kupfer/ui/listen.py
index a3817d4..c1d266c 100644
--- a/kupfer/ui/listen.py
+++ b/kupfer/ui/listen.py
@@ -61,6 +61,9 @@ class Service (ExportedGObject):
@dbus.service.method(interface_name, in_signature="s")
def PutFiles(self, fileuris):
+ # files sent with dbus-send from kupfer have a custom comma
+ # escape that we have to unescape here
+ fileuris[:] = [f.replace("%%kupfercomma%%", ",") for f in fileuris]
self.emit("put-files", fileuris)
@dbus.service.method(interface_name, in_signature="s")
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]