[kupfer: 2/7] plugin.truecrypt: +escape apostrophes in file name before call TC.



commit 31228d5047437eb27608993971ff08ef70672b8e
Author: Karol BÄ?dkowski <karol bedkowsk+gh gmail com>
Date:   Tue Dec 8 21:00:13 2009 +0100

    plugin.truecrypt: +escape apostrophes in file name before call TC.

 kupfer/plugin/truecrypt.py |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/kupfer/plugin/truecrypt.py b/kupfer/plugin/truecrypt.py
index de00cf9..7f5b273 100644
--- a/kupfer/plugin/truecrypt.py
+++ b/kupfer/plugin/truecrypt.py
@@ -19,6 +19,13 @@ __author__ = "Karol BÄ?dkowski <karol bedkowski gmail com>"
 _HISTORY_FILE = "~/.TrueCrypt/History.xml"
 
 
+def mount_volume_in_truecrypt(filepath):
+	''' Mount file in Truecrypt. '''
+	# escape ' characters
+	filepath = filepath.replace("'", "'\\''")
+	utils.launch_commandline("truecrypt '%s'" % filepath)
+
+
 class Volume(Leaf):
 	def __init__(self, path, name):
 		Leaf.__init__(self, path, name)
@@ -39,7 +46,7 @@ class MountVolume(Action):
 		Action.__init__(self, _("Mount Volume"))
 		
 	def activate(self, leaf):
-		utils.launch_commandline('truecrypt ' + leaf.object)
+		mount_volume_in_truecrypt(leaf.object)
 
 
 class MountFile(Action):
@@ -50,7 +57,7 @@ class MountFile(Action):
 		Action.__init__(self, _("Mount File in Truecrypt"))
 
 	def activate(self, leaf):
-		utils.launch_commandline('truecrypt ' + leaf.object)
+		mount_volume_in_truecrypt(leaf.object)
 
 	def item_types(self):
 		yield FileLeaf



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]