mirror of
				https://github.com/arsenetar/dupeguru.git
				synced 2025-09-11 17:58:17 +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):
 | 
					def build_normal(edition, ui, dev, conf):
 | 
				
			||||||
    print("Building dupeGuru {0} with UI {1}".format(edition.upper(), ui))
 | 
					    print("Building dupeGuru {0} with UI {1}".format(edition.upper(), ui))
 | 
				
			||||||
    add_to_pythonpath('.')
 | 
					    add_to_pythonpath('.')
 | 
				
			||||||
    build_help(edition)
 | 
					 | 
				
			||||||
    print("Building dupeGuru")
 | 
					    print("Building dupeGuru")
 | 
				
			||||||
    if edition == 'pe':
 | 
					    if edition == 'pe':
 | 
				
			||||||
        build_pe_modules(ui)
 | 
					        build_pe_modules(ui)
 | 
				
			||||||
@ -325,6 +324,9 @@ def build_normal(edition, ui, dev, conf):
 | 
				
			|||||||
        build_cocoa(edition, dev)
 | 
					        build_cocoa(edition, dev)
 | 
				
			||||||
    elif ui == 'qt':
 | 
					    elif ui == 'qt':
 | 
				
			||||||
        build_qt(edition, dev, conf)
 | 
					        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():
 | 
					def main():
 | 
				
			||||||
    options = parse_args()
 | 
					    options = parse_args()
 | 
				
			||||||
 | 
				
			|||||||
@ -143,9 +143,8 @@ class Directories(directories.Directories):
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DupeGuruME(DupeGuruBase):
 | 
					class DupeGuruME(DupeGuruBase):
 | 
				
			||||||
    def __init__(self, view, appdata):
 | 
					    def __init__(self, view):
 | 
				
			||||||
        appdata = op.join(appdata, 'dupeGuru Music Edition')
 | 
					        DupeGuruBase.__init__(self, view)
 | 
				
			||||||
        DupeGuruBase.__init__(self, view, appdata)
 | 
					 | 
				
			||||||
        # Use fileclasses set in DupeGuruBase.__init__()
 | 
					        # Use fileclasses set in DupeGuruBase.__init__()
 | 
				
			||||||
        self.directories = Directories(fileclasses=self.directories.fileclasses)
 | 
					        self.directories = Directories(fileclasses=self.directories.fileclasses)
 | 
				
			||||||
        self.dead_tracks = []
 | 
					        self.dead_tracks = []
 | 
				
			||||||
 | 
				
			|||||||
@ -171,9 +171,8 @@ class Directories(directories.Directories):
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DupeGuruPE(DupeGuruBase):
 | 
					class DupeGuruPE(DupeGuruBase):
 | 
				
			||||||
    def __init__(self, view, appdata):
 | 
					    def __init__(self, view):
 | 
				
			||||||
        appdata = op.join(appdata, 'dupeGuru Picture Edition')
 | 
					        DupeGuruBase.__init__(self, view)
 | 
				
			||||||
        DupeGuruBase.__init__(self, view, appdata)
 | 
					 | 
				
			||||||
        self.directories = Directories()
 | 
					        self.directories = Directories()
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def _do_delete(self, j, *args):
 | 
					    def _do_delete(self, j, *args):
 | 
				
			||||||
 | 
				
			|||||||
@ -68,9 +68,10 @@ class Directories(DirectoriesBase):
 | 
				
			|||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class DupeGuru(DupeGuruBase):
 | 
					class DupeGuru(DupeGuruBase):
 | 
				
			||||||
    def __init__(self, view, appdata):
 | 
					    def __init__(self, view):
 | 
				
			||||||
        appdata = op.join(appdata, 'dupeGuru')
 | 
					        # appdata = op.join(appdata, 'dupeGuru')
 | 
				
			||||||
        DupeGuruBase.__init__(self, view, appdata)
 | 
					        # print(repr(appdata))
 | 
				
			||||||
 | 
					        DupeGuruBase.__init__(self, view)
 | 
				
			||||||
        self.directories = Directories()
 | 
					        self.directories = Directories()
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -20,6 +20,7 @@
 | 
				
			|||||||
- (NSString *)bundleIdentifier;
 | 
					- (NSString *)bundleIdentifier;
 | 
				
			||||||
- (NSString *)appVersion;
 | 
					- (NSString *)appVersion;
 | 
				
			||||||
- (NSString *)osxVersion;
 | 
					- (NSString *)osxVersion;
 | 
				
			||||||
 | 
					- (NSString *)bundleInfo:(NSString *)key;
 | 
				
			||||||
- (void)postNotification:(NSString *)name userInfo:(NSDictionary *)userInfo;
 | 
					- (void)postNotification:(NSString *)name userInfo:(NSDictionary *)userInfo;
 | 
				
			||||||
- (id)prefValue:(NSString *)prefname;
 | 
					- (id)prefValue:(NSString *)prefname;
 | 
				
			||||||
- (void)setPrefValue:(NSString *)prefname value:(id)value;
 | 
					- (void)setPrefValue:(NSString *)prefname value:(id)value;
 | 
				
			||||||
 | 
				
			|||||||
@ -92,6 +92,11 @@
 | 
				
			|||||||
    return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
 | 
					    return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleVersion"];
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- (NSString *)bundleInfo:(NSString *)key
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    return [[NSBundle mainBundle] objectForInfoDictionaryKey:key];
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- (NSString *)osxVersion
 | 
					- (NSString *)osxVersion
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
    SInt32 major, minor, bugfix;
 | 
					    SInt32 major, minor, bugfix;
 | 
				
			||||||
 | 
				
			|||||||
@ -144,7 +144,7 @@ class DupeGuru(RegistrableApplication, Broadcaster):
 | 
				
			|||||||
            logging.debug("Debug mode enabled")
 | 
					            logging.debug("Debug mode enabled")
 | 
				
			||||||
        RegistrableApplication.__init__(self, view, appid=1)
 | 
					        RegistrableApplication.__init__(self, view, appid=1)
 | 
				
			||||||
        Broadcaster.__init__(self)
 | 
					        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):
 | 
					        if not op.exists(self.appdata):
 | 
				
			||||||
            os.makedirs(self.appdata)
 | 
					            os.makedirs(self.appdata)
 | 
				
			||||||
        self.directories = directories.Directories()
 | 
					        self.directories = directories.Directories()
 | 
				
			||||||
 | 
				
			|||||||
@ -6,6 +6,8 @@
 | 
				
			|||||||
# which should be included with this package. The terms are also available at 
 | 
					# which should be included with this package. The terms are also available at 
 | 
				
			||||||
# http://www.hardcoded.net/licenses/bsd_license
 | 
					# http://www.hardcoded.net/licenses/bsd_license
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import os.path as op
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class SpecialFolder:
 | 
					class SpecialFolder:
 | 
				
			||||||
    AppData = 1
 | 
					    AppData = 1
 | 
				
			||||||
    Cache = 2
 | 
					    Cache = 2
 | 
				
			||||||
@ -25,12 +27,15 @@ def reveal_path(path):
 | 
				
			|||||||
    """
 | 
					    """
 | 
				
			||||||
    _reveal_path(str(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``.
 | 
					    """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:
 | 
					try:
 | 
				
			||||||
    from cocoa import proxy
 | 
					    from cocoa import proxy
 | 
				
			||||||
@ -38,17 +43,19 @@ try:
 | 
				
			|||||||
    _open_path = proxy.openPath_
 | 
					    _open_path = proxy.openPath_
 | 
				
			||||||
    _reveal_path = proxy.revealPath_
 | 
					    _reveal_path = proxy.revealPath_
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    def _special_folder_path(special_folder):
 | 
					    def _special_folder_path(special_folder, appname=None):
 | 
				
			||||||
        if special_folder == SpecialFolder.Cache:
 | 
					        if special_folder == SpecialFolder.Cache:
 | 
				
			||||||
            return proxy.getCachePath()
 | 
					            base = proxy.getCachePath()
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            return proxy.getAppdataPath()
 | 
					            base = proxy.getAppdataPath()
 | 
				
			||||||
 | 
					        if not appname:
 | 
				
			||||||
 | 
					            appname = proxy.bundleInfo_('CFBundleName')
 | 
				
			||||||
 | 
					        return op.join(base, appname)
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
except ImportError:
 | 
					except ImportError:
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
        from PyQt4.QtCore import QUrl
 | 
					        from PyQt4.QtCore import QUrl
 | 
				
			||||||
        from PyQt4.QtGui import QDesktopServices
 | 
					        from PyQt4.QtGui import QDesktopServices
 | 
				
			||||||
        import os.path as op
 | 
					 | 
				
			||||||
        def _open_path(path):
 | 
					        def _open_path(path):
 | 
				
			||||||
            url = QUrl.fromLocalFile(str(path))
 | 
					            url = QUrl.fromLocalFile(str(path))
 | 
				
			||||||
            QDesktopServices.openUrl(url)
 | 
					            QDesktopServices.openUrl(url)
 | 
				
			||||||
@ -56,7 +63,7 @@ except ImportError:
 | 
				
			|||||||
        def _reveal_path(path):
 | 
					        def _reveal_path(path):
 | 
				
			||||||
            _open_path(op.dirname(str(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:
 | 
					            if special_folder == SpecialFolder.Cache:
 | 
				
			||||||
                qtfolder = QDesktopServices.CacheLocation
 | 
					                qtfolder = QDesktopServices.CacheLocation
 | 
				
			||||||
            else:
 | 
					            else:
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user