mirror of
https://github.com/arsenetar/dupeguru.git
synced 2025-03-09 13:24:35 +00:00
Fixed appdata logic which was broken on OS X.
This commit is contained in:
parent
12cf9b800b
commit
76f45fb5a6
4
build.py
4
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()
|
||||
|
@ -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 = []
|
||||
|
@ -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):
|
||||
|
@ -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()
|
||||
|
||||
|
||||
|
@ -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;
|
||||
|
@ -92,6 +92,11 @@
|
||||
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
|
||||
}
|
||||
|
||||
- (NSString *)bundleInfo:(NSString *)key
|
||||
{
|
||||
return [[NSBundle mainBundle] objectForInfoDictionaryKey:key];
|
||||
}
|
||||
|
||||
- (NSString *)osxVersion
|
||||
{
|
||||
SInt32 major, minor, bugfix;
|
||||
|
@ -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()
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user