diff --git a/build.py b/build.py index 5ae90608..9da002c8 100644 --- a/build.py +++ b/build.py @@ -317,7 +317,6 @@ def build_pe_modules(ui): def build_normal(edition, ui, dev, conf): print("Building dupeGuru {0} with UI {1}".format(edition.upper(), ui)) add_to_pythonpath('.') - build_help(edition) print("Building dupeGuru") if edition == 'pe': build_pe_modules(ui) @@ -325,6 +324,9 @@ def build_normal(edition, ui, dev, conf): build_cocoa(edition, dev) elif ui == 'qt': build_qt(edition, dev, conf) + # We used to build the help first, but autodoc building messes up with pythonpaths and makes our + # whole build process buggy. We do it last. + build_help(edition) def main(): options = parse_args() diff --git a/cocoa/inter/app_me.py b/cocoa/inter/app_me.py index f0010609..1988f82f 100644 --- a/cocoa/inter/app_me.py +++ b/cocoa/inter/app_me.py @@ -143,9 +143,8 @@ class Directories(directories.Directories): class DupeGuruME(DupeGuruBase): - def __init__(self, view, appdata): - appdata = op.join(appdata, 'dupeGuru Music Edition') - DupeGuruBase.__init__(self, view, appdata) + def __init__(self, view): + DupeGuruBase.__init__(self, view) # Use fileclasses set in DupeGuruBase.__init__() self.directories = Directories(fileclasses=self.directories.fileclasses) self.dead_tracks = [] diff --git a/cocoa/inter/app_pe.py b/cocoa/inter/app_pe.py index f9104baf..fe74bc85 100644 --- a/cocoa/inter/app_pe.py +++ b/cocoa/inter/app_pe.py @@ -171,9 +171,8 @@ class Directories(directories.Directories): class DupeGuruPE(DupeGuruBase): - def __init__(self, view, appdata): - appdata = op.join(appdata, 'dupeGuru Picture Edition') - DupeGuruBase.__init__(self, view, appdata) + def __init__(self, view): + DupeGuruBase.__init__(self, view) self.directories = Directories() def _do_delete(self, j, *args): diff --git a/cocoa/inter/app_se.py b/cocoa/inter/app_se.py index da77170a..7b08bc08 100644 --- a/cocoa/inter/app_se.py +++ b/cocoa/inter/app_se.py @@ -68,9 +68,10 @@ class Directories(DirectoriesBase): class DupeGuru(DupeGuruBase): - def __init__(self, view, appdata): - appdata = op.join(appdata, 'dupeGuru') - DupeGuruBase.__init__(self, view, appdata) + def __init__(self, view): + # appdata = op.join(appdata, 'dupeGuru') + # print(repr(appdata)) + DupeGuruBase.__init__(self, view) self.directories = Directories() diff --git a/cocoalib/cocoa/CocoaProxy.h b/cocoalib/cocoa/CocoaProxy.h index 613cabb9..773c56fa 100644 --- a/cocoalib/cocoa/CocoaProxy.h +++ b/cocoalib/cocoa/CocoaProxy.h @@ -20,6 +20,7 @@ - (NSString *)bundleIdentifier; - (NSString *)appVersion; - (NSString *)osxVersion; +- (NSString *)bundleInfo:(NSString *)key; - (void)postNotification:(NSString *)name userInfo:(NSDictionary *)userInfo; - (id)prefValue:(NSString *)prefname; - (void)setPrefValue:(NSString *)prefname value:(id)value; diff --git a/cocoalib/cocoa/CocoaProxy.m b/cocoalib/cocoa/CocoaProxy.m index 27948324..f6a6a204 100644 --- a/cocoalib/cocoa/CocoaProxy.m +++ b/cocoalib/cocoa/CocoaProxy.m @@ -92,6 +92,11 @@ return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"]; } +- (NSString *)bundleInfo:(NSString *)key +{ + return [[NSBundle mainBundle] objectForInfoDictionaryKey:key]; +} + - (NSString *)osxVersion { SInt32 major, minor, bugfix; diff --git a/core/app.py b/core/app.py index c1ba172f..d7f9bc85 100644 --- a/core/app.py +++ b/core/app.py @@ -144,7 +144,7 @@ class DupeGuru(RegistrableApplication, Broadcaster): logging.debug("Debug mode enabled") RegistrableApplication.__init__(self, view, appid=1) Broadcaster.__init__(self) - self.appdata = desktop.special_folder_path(desktop.SpecialFolder.AppData) + self.appdata = desktop.special_folder_path(desktop.SpecialFolder.AppData, appname=self.NAME) if not op.exists(self.appdata): os.makedirs(self.appdata) self.directories = directories.Directories() diff --git a/hscommon/desktop.py b/hscommon/desktop.py index ea5d707f..581a5963 100644 --- a/hscommon/desktop.py +++ b/hscommon/desktop.py @@ -6,6 +6,8 @@ # which should be included with this package. The terms are also available at # http://www.hardcoded.net/licenses/bsd_license +import os.path as op + class SpecialFolder: AppData = 1 Cache = 2 @@ -25,12 +27,15 @@ def reveal_path(path): """ _reveal_path(str(path)) -def special_folder_path(special_folder): +def special_folder_path(special_folder, appname=None): """Returns the path of ``special_folder``. - ``special_folder`` is a SpecialFolder.* const. + ``special_folder`` is a SpecialFolder.* const. The result is the special folder for the current + application. The running process' application info is used to determine relevant information. + + You can override the application name with ``appname``. This argument is ingored under Qt. """ - return _special_folder_path(special_folder) + return _special_folder_path(special_folder, appname) try: from cocoa import proxy @@ -38,17 +43,19 @@ try: _open_path = proxy.openPath_ _reveal_path = proxy.revealPath_ - def _special_folder_path(special_folder): + def _special_folder_path(special_folder, appname=None): if special_folder == SpecialFolder.Cache: - return proxy.getCachePath() + base = proxy.getCachePath() else: - return proxy.getAppdataPath() + base = proxy.getAppdataPath() + if not appname: + appname = proxy.bundleInfo_('CFBundleName') + return op.join(base, appname) except ImportError: try: from PyQt4.QtCore import QUrl from PyQt4.QtGui import QDesktopServices - import os.path as op def _open_path(path): url = QUrl.fromLocalFile(str(path)) QDesktopServices.openUrl(url) @@ -56,7 +63,7 @@ except ImportError: def _reveal_path(path): _open_path(op.dirname(str(path))) - def _special_folder_path(special_folder): + def _special_folder_path(special_folder, appname=None): if special_folder == SpecialFolder.Cache: qtfolder = QDesktopServices.CacheLocation else: