[kupfer: 3/7] core: don't load no existing directories into catalog
- From: Ulrik Sverdrup <usverdrup src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [kupfer: 3/7] core: don't load no existing directories into catalog
- Date: Tue, 22 May 2012 15:22:17 +0000 (UTC)
commit 450e116451b22f6f209f759a94f8312df26f5aae
Author: Karol BÄdkowski <karol bedkowski gmail com>
Date: Fri May 18 22:59:07 2012 +0200
core: don't load no existing directories into catalog
os.path.samefile crash when given directories not exist.
Closes: LP#1000980
kupfer/core/data.py | 2 ++
kupfer/obj/sources.py | 3 ++-
2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/kupfer/core/data.py b/kupfer/core/data.py
index 652835f..8403f3b 100644
--- a/kupfer/core/data.py
+++ b/kupfer/core/data.py
@@ -542,6 +542,8 @@ class DataController (gobject.GObject, pretty.OutputMixin):
for coll, direct in zip((s_sources, S_sources), (False, True)):
for item in setctl.get_directories(direct):
+ if not os.path.isdir(item):
+ continue
coll.append(dir_source(item))
dir_depth = source_config("DeepDirectories", "Depth")
diff --git a/kupfer/obj/sources.py b/kupfer/obj/sources.py
index 93d255d..0e090b5 100644
--- a/kupfer/obj/sources.py
+++ b/kupfer/obj/sources.py
@@ -114,7 +114,8 @@ class DirectorySource (Source, PicklingHelperMixin, FilesystemWatchMixin):
return "folder"
def get_leaf_repr(self):
- if os.path.samefile(self.directory, os.path.expanduser("~")):
+ if os.path.isdir(self.directory) and \
+ os.path.samefile(self.directory, os.path.expanduser("~")):
alias = _("Home Folder")
else:
alias = None
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]