diff --git a/py/app.py b/py/app.py index 0e03603d..5e0a5f07 100644 --- a/py/app.py +++ b/py/app.py @@ -19,9 +19,7 @@ from hsutil.reg import RegistrableApplication, RegistrationRequired from hsutil.misc import flatten, first from hsutil.str import escape -import directories -import results -import scanner +from . import directories, results, scanner JOB_SCAN = 'job_scan' JOB_LOAD = 'job_load' diff --git a/py/app_pe_cocoa.py b/py/app_pe_cocoa.py index eee96086..6d3b22e9 100644 --- a/py/app_pe_cocoa.py +++ b/py/app_pe_cocoa.py @@ -133,6 +133,8 @@ class DupeGuruPE(app_cocoa.DupeGuru): def _create_iphoto_library(self): ud = NSUserDefaults.standardUserDefaults() prefs = ud.persistentDomainForName_('com.apple.iApps') + if 'iPhotoRecentDatabases' not in prefs: + raise directories.InvalidPathError plisturl = NSURL.URLWithString_(prefs['iPhotoRecentDatabases'][0]) plistpath = Path(plisturl.path()) return IPhotoLibrary(plistpath) @@ -185,13 +187,10 @@ class DupeGuruPE(app_cocoa.DupeGuru): return result def AddDirectory(self, d): - try: - added = self.directories.add_path(Path(d)) - if d == 'iPhoto Library': - added.update() - return 0 - except directories.AlreadyThereError: - return 1 + result = app_cocoa.DupeGuru.AddDirectory(self, d) + if (result == 0) and (d == 'iPhoto Library'): + added.update() + return result def CopyOrMove(self, dupe, copy, destination, dest_type): if isinstance(dupe, IPhoto):