Commits

Amit Mendapara committed cf6d9ab

Fixed _is_mounted (path with white space).

  • Participants
  • Parent commits 4ab9888

Comments (0)

Files changed (1)

 
 diff -r a3d2c43d4388 gnome-encfs
 --- a/gnome-encfs	Mon Jul 18 22:26:50 2011 +0200
-+++ b/gnome-encfs	Fri Sep 02 16:48:53 2011 +0530
-@@ -65,6 +65,7 @@
++++ b/gnome-encfs	Fri Sep 02 16:54:54 2011 +0530
+@@ -26,6 +26,7 @@
+ import optparse
+ import subprocess
+ import sys
++import re
+ 
+ from xdg.DesktopEntry import DesktopEntry as xdg_de
+ from xdg.BaseDirectory import xdg_config_home as xdg_ch
+@@ -65,6 +66,7 @@
  
  USAGE = """Usage: %prog --list
         %prog --mount [ENCFS-PATH-or-MOUNT-POINT]
         %prog --add ENCFS-PATH MOUNT-POINT
         %prog --edit MOUNT-POINT
         %prog --remove MOUNT-POINT"""
-@@ -95,6 +96,8 @@
+@@ -95,6 +97,8 @@
                    help="list all EncFS items stored in keyring")
      op.add_option("-m", "--mount", action="store_true", default=False,
                    help="mount all or selected EncFS paths stored in keyring")
      op.add_option("-a", "--add", action="store_true", default=False,
                    help="add a new EncFS item to keyring")
      op.add_option("-e", "--edit", action="store_true", default=False,
-@@ -124,7 +127,7 @@
+@@ -124,7 +128,7 @@
      except ValueError:
          opts.autostart = False
  
          op.print_help()
          op.exit(1)
  
-@@ -394,6 +397,40 @@
+@@ -178,9 +182,11 @@
+     p = subprocess.Popen(["mount"], stdout=subprocess.PIPE)
+     mount = p.communicate()[0]
+     lines = mount.strip('\n').split('\n')
+-    points = map(lambda line: line.split()[2], lines)
+-    points = [os.path.abspath(p) for p in points]
+-    return os.path.abspath(mpoint) in points
++    pat = re.compile(r"^(.*?) on (%s) type .*$" % mpoint)
++    for line in lines:
++    	if pat.match(line):
++    		return True
++    return False
+ 
+ def _is_encfs(epath):
+     """Check if 'epath' points to an EncFS directory."""
+@@ -394,6 +400,40 @@
  
      return rc
  
  # =============================================================================
  # main
  # =============================================================================
-@@ -408,6 +445,8 @@
+@@ -408,6 +448,8 @@
          ok = list_items(opts.p1)
      elif opts.mount:
          ok = mount_items(opts.p1, opts.autostart)