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.misc import flatten, first
|
||||||
from hsutil.str import escape
|
from hsutil.str import escape
|
||||||
|
|
||||||
import directories
|
from . import directories, results, scanner
|
||||||
import results
|
|
||||||
import scanner
|
|
||||||
|
|
||||||
JOB_SCAN = 'job_scan'
|
JOB_SCAN = 'job_scan'
|
||||||
JOB_LOAD = 'job_load'
|
JOB_LOAD = 'job_load'
|
||||||
|
@ -133,6 +133,8 @@ class DupeGuruPE(app_cocoa.DupeGuru):
|
|||||||
def _create_iphoto_library(self):
|
def _create_iphoto_library(self):
|
||||||
ud = NSUserDefaults.standardUserDefaults()
|
ud = NSUserDefaults.standardUserDefaults()
|
||||||
prefs = ud.persistentDomainForName_('com.apple.iApps')
|
prefs = ud.persistentDomainForName_('com.apple.iApps')
|
||||||
|
if 'iPhotoRecentDatabases' not in prefs:
|
||||||
|
raise directories.InvalidPathError
|
||||||
plisturl = NSURL.URLWithString_(prefs['iPhotoRecentDatabases'][0])
|
plisturl = NSURL.URLWithString_(prefs['iPhotoRecentDatabases'][0])
|
||||||
plistpath = Path(plisturl.path())
|
plistpath = Path(plisturl.path())
|
||||||
return IPhotoLibrary(plistpath)
|
return IPhotoLibrary(plistpath)
|
||||||
@ -185,13 +187,10 @@ class DupeGuruPE(app_cocoa.DupeGuru):
|
|||||||
return result
|
return result
|
||||||
|
|
||||||
def AddDirectory(self, d):
|
def AddDirectory(self, d):
|
||||||
try:
|
result = app_cocoa.DupeGuru.AddDirectory(self, d)
|
||||||
added = self.directories.add_path(Path(d))
|
if (result == 0) and (d == 'iPhoto Library'):
|
||||||
if d == 'iPhoto Library':
|
|
||||||
added.update()
|
added.update()
|
||||||
return 0
|
return result
|
||||||
except directories.AlreadyThereError:
|
|
||||||
return 1
|
|
||||||
|
|
||||||
def CopyOrMove(self, dupe, copy, destination, dest_type):
|
def CopyOrMove(self, dupe, copy, destination, dest_type):
|
||||||
if isinstance(dupe, IPhoto):
|
if isinstance(dupe, IPhoto):
|
||||||
|
Loading…
Reference in New Issue
Block a user