mirror of
https://github.com/arsenetar/dupeguru.git
synced 2024-11-17 12:39:02 +00:00
[#23 state:fixed] Wrapped KeyError in prefs for iPhotoDatabase into a InvalidPathError.
--HG-- extra : convert_revision : svn%3Ac306627e-7827-47d3-bdf0-9a457c9553a1/trunk%4010
This commit is contained in:
parent
b05a46a398
commit
97872fc086
@ -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'
|
||||
|
@ -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):
|
||||
|
Loading…
Reference in New Issue
Block a user