Skip to content

Commit

Permalink
Closes #25: Added utf-8 decoding to all places where the pathscanner …
Browse files Browse the repository at this point in the history
…might try to do os.listdirs()
  • Loading branch information
jacobSingh committed Mar 23, 2011
1 parent 207361c commit 12f2ddf
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/pathscanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def initial_scan(self, path):
Returns False if there is already data available for this path.
"""
path = path.decode('utf-8')

# Check if there really isn't any data available for this path.
self.dbcur.execute("SELECT COUNT(filename) FROM %s WHERE path=?" % (self.table), (path,))
Expand All @@ -110,6 +111,7 @@ def initial_scan(self, path):

def purge_path(self, path):
"""purge the metadata for a given path and all its subdirectories"""
path = path.decode('utf-8')

self.dbcur.execute("DELETE FROM %s WHERE path LIKE ?" % (self.table), (path + "%",))
self.dbcur.execute("VACUUM %s" % (self.table))
Expand Down Expand Up @@ -177,6 +179,7 @@ def scan(self, path):
- Can detect deleted directory trees.
"""

path = path.decode('utf-8')
# Fetch the old metadata from the DB.
self.dbcur.execute("SELECT filename, mtime FROM %s WHERE path=?" % (self.table), (path, ))
old_files = {}
Expand Down Expand Up @@ -218,6 +221,7 @@ def scan(self, path):

def scan_tree(self, path):
"""scan a directory tree for changes"""
path = path.decode('utf-8')

# Scan the current directory for changes.
result = self.scan(path)
Expand Down

0 comments on commit 12f2ddf

Please sign in to comment.