Zipper/0000755000175000017500000000000011001514566010772 5ustar dirkdirkZipper/NSObject+Custom.m0000644000175000017500000000060410745235357014101 0ustar dirkdirk#import #import "NSObject+Custom.h" @implementation NSObject (Custom) - (volatile void)methodIsAbstract:(SEL)selector; { [NSException raise:NSInternalInconsistencyException format:@"*** No concrete implementation for selector '%@' in class %@. Abstract definition must be overriden.", NSStringFromSelector(selector), NSStringFromClass(isa)]; } @end Zipper/ZipArchive.m0000644000175000017500000001067210763455374013241 0ustar dirkdirk#import #import "ZipArchive.h" #import "FileInfo.h" #import "NSString+Custom.h" #import "Preferences.h" #import "NSArray+Custom.h" // if the output contains this string in the first line, we have to use a different // parsing routine #define MINI_UNZIP_IDENTIFIER @"MiniUnz" static NSData *_magicBytes = nil; @interface ZipArchive (PrivateAPI) - (NSData *)dataByRunningUnzip; - (NSArray *)listUnzipContents:(NSArray *)lines; @end @implementation ZipArchive : Archive /** * register our supported file extensions with superclass. */ + (void)initialize { // zip files start with 'P K 0x003 0x004' char zipBytes[] = { 'P', 'K', 0x003, 0x004 }; _magicBytes = [[NSData dataWithBytes:zipBytes length:4] retain]; [self registerFileExtension:@"zip" forArchiveClass:self]; [self registerFileExtension:@"jar" forArchiveClass:self]; } + (NSString *)unarchiveExecutable { return [Preferences zipExecutable]; } + (BOOL)hasRatio; { // unzip does provide info about the compression ratio return YES; } + (NSString *)archiveType { return @"Zip"; } + (NSData *)magicBytes { return _magicBytes; } //------------------------------------------------------------------------------ // expanding the archive //------------------------------------------------------------------------------ - (int)expandFiles:(NSArray *)files withPathInfo:(BOOL)usePathInfo toPath:(NSString *)path { FileInfo *fileInfo; NSMutableArray *args; args = [NSMutableArray array]; // be really quiet [args addObject:@"-qq"]; // overwrite without warning [args addObject:@"-o"]; if (usePathInfo == NO) { // junk paths [args addObject:@"-j"]; } [args addObject:[self path]]; if (files != nil) { NSEnumerator *cursor = [files objectEnumerator]; while ((fileInfo = [cursor nextObject]) != nil) { [args addObject:[fileInfo fullPath]]; } } // destination dir [args addObject:@"-d"]; [args addObject:path]; return [self runUnarchiverWithArguments:args]; } - (NSArray *)listContents { NSData *data = [self dataByRunningUnzip]; NSString *string = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; NSArray *lines = [string componentsSeparatedByString:@"\n"]; if ([[lines objectAtIndex:0] containsString:MINI_UNZIP_IDENTIFIER]) { // take out the first 6 lines (header) lines = [lines subarrayWithRange:NSMakeRange(6, [lines count] - 6)]; } return [self listUnzipContents:lines]; } - (NSArray *)listUnzipContents:(NSArray *)lines { NSEnumerator *cursor; NSString *line; NSMutableArray *results = [NSMutableArray array]; cursor = [lines objectEnumerator]; while ((line = [cursor nextObject]) != nil) { int length, index; NSString *path, *date, *time, *ratio, *checksum; NSCalendarDate *calendarDate; FileInfo *info; NSArray *components; if ([line length] == 0) { continue; } components = [line componentsSeparatedByString:@" "]; components = [components arrayByRemovingEmptyStrings]; length = [[components objectAtIndex:0] intValue]; ratio = [components objectAtIndex:3]; // extract the path. The checksum is the last token before the full path // (which can contain blanks) checksum = [components objectAtIndex:6]; index = [line rangeOfString:checksum].location; index += [checksum length]; path = [[line substringFromIndex:index] stringByRemovingWhitespaceFromBeginning]; date = [components objectAtIndex:4]; time = [components objectAtIndex:5]; date = [NSString stringWithFormat:@"%@ %@", date, time]; calendarDate = [NSCalendarDate dateWithString:date calendarFormat:@"%m-%d-%y %H:%M"]; // we skip plain directory entries if ([path hasSuffix:@"/"] == NO) { info = [FileInfo newWithPath:path date:calendarDate size:[NSNumber numberWithInt:length] ratio:ratio]; [results addObject:info]; } } return results; } //------------------------------------------------------------------------------ // private API //------------------------------------------------------------------------------ - (NSData *)dataByRunningUnzip { // l = list // v = display all zip infos (Ratio etc.) // qq = quiet, this is important for skipping comments in archives and for skipping // the nice headers for readable output NSArray *args = [NSArray arrayWithObjects:@"-lvqq", [self path], nil]; return [self dataByRunningUnachiverWithArguments:args]; } @end Zipper/FileIcon.tiff0000644000175000017500000002000610745235357013346 0ustar dirkdirkII*    Q  &ZY>g12c] ( =?ñOM- VXڠJH i opĻЦHImqq !ȃy}  00<9 17ĶRR  8;č./y : egӻǀ  ]WOSt$0áøȚ*0 cf>C  gjPTaeW^5;ÂHKʇ.&r [(-Ȟ ojɫ‡9 psÑ GEױƿ[W :A" s#)np+6  ) ֥Ĩ..vCY` b$"kbb]\Y @H-- ?      Cws><IJ%Z^ne&KN|{ȳĩfi 6 !!A<Ǧĝeh]cX`IN;:61{X 2 8 CC69՚KNMVƺŵǫо¿ҸϾηok>  OPwtut"')EGimlmGE00" 8D-2/<ĻˍHH、¹ϹǽȺŽͯrsTZևǔEKCJϒвsnE  \aRQu{JNʱý˵ǭĊr(Y[Ž|y49٣üкʮȶ̕ # 19ňfo IK÷öonJPVYb_ot$( !ח¼Ϻɽ˽˽˱ffHI̅ee>GӑacXXԩpo78bdɅ " +, VZff~,,{{MI[a [Y˾κξcbqsձ@KTSָHJ]]&% 47DR3= #ōKP  ajyz_e   ldga^ce$+ .*Ͱ̽ɾ˽˽˺{CM`]TZ&EJ٭ˏ(2"  ʈIH$ebкʈGHY[լǹ¼Ѫ)(&(|=8Ze    =>է¼νĺϷńKG.6%,pqŸƫVW!%!(ޒ֫¯ȻͻʷȺɵū¢'* YckdfZ]nnvqzvƳìīƯȠdm[Y͍<;.(^g563401549:57),(.~u}14KKŒTY"'՜ɺخ]d4<  `>& EGjipnxzqsinchTZ=B02??isEF,'uy<846~ĶĬqpEC>9o CD`b!( !)W^.-VS՗/,ORǜȦss("\    ,0?=  "fljn&%ptDZƸDŽ21 `  ˈfhgg!  $&--҂ƵëOS )   J]_+%   PU¤ŞΛ>Gs"88,)  +2ӧ»λȕ8; Z ~Ιfm    "$ͫǿӝ7< E/2:<++ωefȵȺahBD!   ][Է˸ɺɂ"E2 )&ܰʶÜ+5 O".2KJ)&miĸɺEN V c=B˸KP\ @67}|~ tJP&* < s 0) 2@(R/home/dirk/Projects/GNUstep/Zipper/zipper-48.tiffCreated with The GIMPHHZipper/ArchiveService.h0000644000175000017500000000030010745235357014052 0ustar dirkdirk#import @interface ArchiveService : NSObject { } - (void)createZippedTarArchive:(NSPasteboard *)pboard userData:(NSString *)userData error:(NSString **)error; @end Zipper/zipper.tiff0000644000175000017500000002000610745235357013167 0ustar dirkdirkII*    Q  &ZY>g12c] ( =?ñOM- VXڠJH i opĻЦHImqq !ȃy}  00<9 17ĶRR  8;č./y : egӻǀ  ]WOSt$0áøȚ*0 cf>C  gjPTaeW^5;ÂHKʇ.&r [(-Ȟ ojɫ‡9 psÑ GEױƿ[W :A" s#)np+6  ) ֥Ĩ..vCY` b$"kbb]\Y @H-- ?      Cws><IJ%Z^ne&KN|{ȳĩfi 6 !!A<Ǧĝeh]cX`IN;:61{X 2 8 CC69՚KNMVƺŵǫо¿ҸϾηok>  OPwtut"')EGimlmGE00" 8D-2/<ĻˍHH、¹ϹǽȺŽͯrsTZևǔEKCJϒвsnE  \aRQu{JNʱý˵ǭĊr(Y[Ž|y49٣üкʮȶ̕ # 19ňfo IK÷öonJPVYb_ot$( !ח¼Ϻɽ˽˽˱ffHI̅ee>GӑacXXԩpo78bdɅ " +, VZff~,,{{MI[a [Y˾κξcbqsձ@KTSָHJ]]&% 47DR3= #ōKP  ajyz_e   ldga^ce$+ .*Ͱ̽ɾ˽˽˺{CM`]TZ&EJ٭ˏ(2"  ʈIH$ebкʈGHY[լǹ¼Ѫ)(&(|=8Ze    =>է¼νĺϷńKG.6%,pqŸƫVW!%!(ޒ֫¯ȻͻʷȺɵū¢'* YckdfZ]nnvqzvƳìīƯȠdm[Y͍<;.(^g563401549:57),(.~u}14KKŒTY"'՜ɺخ]d4<  `>& EGjipnxzqsinchTZ=B02??isEF,'uy<846~ĶĬqpEC>9o CD`b!( !)W^.-VS՗/,ORǜȦss("\    ,0?=  "fljn&%ptDZƸDŽ21 `  ˈfhgg!  $&--҂ƵëOS )   J]_+%   PU¤ŞΛ>Gs"88,)  +2ӧ»λȕ8; Z ~Ιfm    "$ͫǿӝ7< E/2:<++ωefȵȺahBD!   ][Է˸ɺɂ"E2 )&ܰʶÜ+5 O".2KJ)&miĸɺEN V c=B˸KP\ @67}|~ tJP&* < s 0) 2@(R/home/dirk/Projects/GNUstep/Zipper/zipper-48.tiffCreated with The GIMPHHZipper/SevenZipArchive.m0000644000175000017500000000756110745235357014242 0ustar dirkdirk#import #import "SevenZipArchive.h" #import "FileInfo.h" #import "NSString+Custom.h" #import "Preferences.h" #import "NSArray+Custom.h" @interface SevenZipArchive (PrivateAPI) - (NSData *)dataByRunningSevenZip; - (NSArray *)listSevenZipContents:(NSArray *)lines; @end @implementation SevenZipArchive : Archive /** * register our supported file extensions with superclass. */ + (void)initialize { [self registerFileExtension:@"7z" forArchiveClass:self]; [self registerFileExtension:@"7za" forArchiveClass:self]; } + (NSString *)unarchiveExecutable { return [Preferences sevenZipExecutable]; } + (BOOL)hasRatio; { return NO; } + (NSString *)archiveType { return @"7zip"; } //------------------------------------------------------------------------------ // expanding the archive //------------------------------------------------------------------------------ - (int)expandFiles:(NSArray *)files withPathInfo:(BOOL)usePathInfo toPath:(NSString *)path { FileInfo *fileInfo; NSMutableArray *args; args = [NSMutableArray array]; if (usePathInfo == YES) { [args addObject:@"x"]; } else { // extract flat [args addObject:@"e"]; } // assume yes on all queries (needed for silently overwriting files) [args addObject:@"-y"]; // destination dir, path must not be separated with blank from the 'o' option [args addObject:[@"-o" stringByAppendingString:path]]; // add archive filename [args addObject:[self path]]; if (files != nil) { NSEnumerator *cursor = [files objectEnumerator]; while ((fileInfo = [cursor nextObject]) != nil) { [args addObject:[fileInfo fullPath]]; } } return [self runUnarchiverWithArguments:args]; } - (NSArray *)listContents { NSData *data = [self dataByRunningSevenZip]; NSString *string = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease]; NSArray *lines = [string componentsSeparatedByString:@"\n"]; // take out first 8 lines (header) and last 2 lines (footer) lines = [lines subarrayWithRange:NSMakeRange(8, [lines count] - 8)]; lines = [lines subarrayWithRange:NSMakeRange(0, [lines count] - 3)]; return [self listSevenZipContents:lines]; } //------------------------------------------------------------------------------ // private API //------------------------------------------------------------------------------ - (NSArray *)listSevenZipContents:(NSArray *)lines { NSEnumerator *cursor; NSString *line; NSMutableArray *results = [NSMutableArray array]; cursor = [lines objectEnumerator]; while ((line = [cursor nextObject]) != nil) { int length; NSString *path, *date, *time, *attributes; NSCalendarDate *calendarDate; FileInfo *info; NSArray *components; if ([line length] == 0) { continue; } components = [line componentsSeparatedByString:@" "]; components = [components arrayByRemovingEmptyStrings]; // directly skip directory entries. Fortunately, 7zip displays attributes for each file attributes = [components objectAtIndex:2]; if ([attributes characterAtIndex:0] == 'D') { continue; } length = [[components objectAtIndex:3] intValue]; // extract the path, it's always the last element path = [[components lastObject] stringByRemovingWhitespaceFromBeginning]; date = [components objectAtIndex:0]; time = [components objectAtIndex:1]; date = [NSString stringWithFormat:@"%@ %@", date, time]; calendarDate = [NSCalendarDate dateWithString:date calendarFormat:@"%Y-%m-%d %H:%M:%S"]; info = [FileInfo newWithPath:path date:calendarDate size:[NSNumber numberWithInt:length]]; [results addObject:info]; } return results; } - (NSData *)dataByRunningSevenZip { // l = list NSArray *args = [NSArray arrayWithObjects:@"l", [self path], nil]; return [self dataByRunningUnachiverWithArguments:args]; } @end Zipper/.project0000644000175000017500000000616710763453667012475 0ustar dirkdirk Zipper org.eclipse.cdt.make.core.makeBuilder org.eclipse.cdt.make.core.cleanBuildTarget org.eclipse.cdt.make.core.enableCleanBuild false org.eclipse.cdt.make.core.append_environment true org.eclipse.cdt.make.core.stopOnError false org.eclipse.cdt.make.core.buildCommand make org.eclipse.cdt.make.core.enabledIncrementalBuild false org.eclipse.cdt.make.core.build.target.inc all org.eclipse.cdt.make.core.incrementalBuildTarget all org.eclipse.cdt.make.core.buildLocation org.eclipse.cdt.make.core.useDefaultBuildCmd true org.eclipse.cdt.make.core.environment org.eclipse.cdt.make.core.enableFullBuild false org.eclipse.cdt.make.core.enableAutoBuild false org.eclipse.cdt.make.core.build.target.auto all org.eclipse.cdt.make.core.build.target.clean org.eclipse.cdt.make.core.fullBuildTarget clean all org.eclipse.cdt.make.core.build.location org.eclipse.cdt.make.core.autoBuildTarget all org.eclipse.cdt.core.errorOutputParser org.eclipse.cdt.core.GCCErrorParser;org.eclipse.cdt.core.GASErrorParser;org.eclipse.cdt.core.GLDErrorParser;org.eclipse.cdt.core.MakeErrorParser;org.eclipse.cdt.core.VCErrorParser; org.eclipse.cdt.make.core.ScannerConfigBuilder org.eclipse.cdt.make.core.ScannerConfigDiscoveryEnabled false org.eclipse.cdt.core.cnature org.eclipse.cdt.make.core.makeNature org.eclipse.cdt.make.core.ScannerConfigNature Zipper/.settings/0000755000175000017500000000000011001514566012710 5ustar dirkdirkZipper/.settings/org.eclipse.cdt.core.prefs0000644000175000017500000000024410763453361017674 0ustar dirkdirk#Wed Mar 05 09:16:49 CET 2008 eclipse.preferences.version=1 indexer/indexerId=org.eclipse.cdt.core.domsourceindexer indexerId=org.eclipse.cdt.core.domsourceindexer Zipper/NSArray+Custom.h0000644000175000017500000000015510745235357013745 0ustar dirkdirk#import @interface NSArray (Custom) - (NSArray *)arrayByRemovingEmptyStrings; @end Zipper/GzipArchive.h0000644000175000017500000000033010745235357013366 0ustar dirkdirk#import #import "Archive.h" @interface GzipArchive : Archive { } - (int)expandFiles:(NSArray *)files withPathInfo:(BOOL)usePathInfo toPath:(NSString *)path; - (NSArray *)listContents; @end Zipper/NSObject+Custom.h0000644000175000017500000000016610745235357014077 0ustar dirkdirk#import @interface NSObject (Custom) - (volatile void)methodIsAbstract:(SEL)selector; @end Zipper/GNUmakefile.postamble0000644000175000017500000000006510745235357015046 0ustar dirkdirkafter-clean:: -rm *.d #after-distclean:: # rm *.d Zipper/createDist.sh0000755000175000017500000000201510745235357013432 0ustar dirkdirk#!/bin/sh # clean everything make distclean (cd Tests; make distclean) workdir=`pwd` tempdir=/tmp/zipper-$$ mkdir $tempdir # make up the filename of the release .tar.gz release=`cat ZipperInfo.plist | grep ApplicationRelease | awk '{ print $3 }' | tr -d '";'` releaseName=Zipper-${release}.tar.gz # insert the correct filename into index.html. Do this before we tar up the whole distro so # the index.html is correct in distro cd $workdir/Site sed -e "s/@@zipper-tar@@/$releaseName/" < template.index.html > index.html # do not include old distro tarball cd $workdir for file in `ls Site/Zipper-*.tar.gz` do rm $file done # copy everything to tempdir cd .. tar cf - Zipper | (cd $tempdir; tar xf -) # remove stuff that's not to be included into distro tarball cd $tempdir find . -name \.svn -exec rm -rf {} \; 2> /dev/null cd Zipper rm -r .xvpics .cvsignore .dir.tiff rm -r Site/.xvpics rm Site/template.index.html cd .. # build the tarball tar czf $releaseName Zipper mv $releaseName $workdir/Site # clean up rm -rf $tempdir Zipper/MainMenu-GNUstep.gsmarkup0000644000175000017500000000214010745235357015612 0ustar dirkdirk Zipper/TableViewDataSource.h0000644000175000017500000000050110745235357015010 0ustar dirkdirk#import @class Archive; #define COL_ID_NAME @"name" #define COL_ID_DATE @"date" #define COL_ID_SIZE @"size" #define COL_ID_PATH @"path" #define COL_ID_RATIO @"ratio" @interface TableViewDataSource : NSObject { @private Archive *_archive; } - (void)setArchive:(Archive *)archive; @end Zipper/NSString+Custom.m0000644000175000017500000000137510745235357014147 0ustar dirkdirk#import #import "NSString+Custom.h" @implementation NSString (Convenience) - (BOOL)containsString:(NSString *)string { return (([self rangeOfString:string]).length > 0); } - (BOOL)isEmpty { return [self isEqual:@""]; } - (NSString *)stringByRemovingWhitespaceFromBeginning { NSCharacterSet *whitespaceSet = nil; NSScanner *theScanner = nil; whitespaceSet = [NSCharacterSet whitespaceCharacterSet]; theScanner = [NSScanner scannerWithString:self]; // do not skip automatically over any chars [theScanner setCharactersToBeSkipped:nil]; // skip all blanks from beginning [theScanner scanCharactersFromSet:whitespaceSet intoString:NULL]; return [self substringFromIndex:[theScanner scanLocation]]; } @end Zipper/sort_ascending.tiff0000644000175000017500000000037610745235357014670 0ustar dirkdirkII*0 P Dx~xA (~?ß8  *(R ' 'Zipper/.cproject0000644000175000017500000000414010763453622012614 0ustar dirkdirk make clean true true make true true Zipper/ZipperDocument.h0000644000175000017500000000037310745235357014132 0ustar dirkdirk#import @class Archive, TableViewDataSource; @interface ZipperDocument : GSMarkupDocument { @private IBOutlet NSTableView *_tableView; Archive *_archive; TableViewDataSource *_tableViewDataSource; } @end Zipper/Preferences.m0000644000175000017500000001500010754476162013422 0ustar dirkdirk#import #import "Preferences.h" #import "NSFileManager+Custom.h" #define X_MISSING_PREF @"MissingPreferenceException" #define X_WRONG_PREF @"WrongPreferenceException" @interface Preferences (PrivateAPI) + (NSString *)stringForKey:(NSString *)key; + (BOOL)boolForKey:(NSString *)key; + (void)checkExecutable:(NSString *)executable withName:(NSString *)name; @end /** * This class encapsulates the access to the app's preferences. It faciliates providing a * Dictionary that will be used instead of NSUserDefaults and searching the PATH environment * variable. */ @implementation Preferences : NSObject /** * To faciliate unit testing it's possible to provide the Preferences class with an NSDictionary * that makes up the preferences. */ static NSDictionary *_replacementPrefs = nil; /** * Additional Preferences loaded from PropertyList file */ static NSDictionary *_plistPrefs; /** * This is the mapping between file extensions and tar's extract option. This option differs * from platform to platform. In order to encapsulate this, Preferences manages this mapping * and clients can ask for a compression argument with compressionArgumentForFile: */ static NSMutableDictionary *_extensionMapping = nil; + (void)initialize { NSString *path; if (_extensionMapping == nil) { _extensionMapping = [[NSMutableDictionary dictionaryWithObjectsAndKeys: @"", @"tar", @"-z", @"gz", @"-z", @"tgz", @"-j", @"bz2", nil] retain]; } // see if there's a property list containing preferences to use path = [[NSBundle bundleForClass:self] pathForResource:@"DefaultPreferences" ofType:@"plist"]; if (path != nil) { _plistPrefs = [[NSDictionary dictionaryWithContentsOfFile:path] retain]; } } + (void)usePreferences:(NSDictionary *)newPrefs; { ASSIGN(_replacementPrefs, newPrefs); } + (NSString *)tarExecutable; { NSString *tar = [self stringForKey:PREF_KEY_TAR]; if (tar == nil) { // search the PATH tar = [[NSFileManager defaultManager] locateExecutable:@"tar"]; } return tar; } + (void)setTarExecutable:(NSString *)newTar { if (newTar != nil) { [[NSUserDefaults standardUserDefaults] setObject:newTar forKey:PREF_KEY_TAR]; } } + (BOOL)isBsdTar; { return [self boolForKey:PREF_KEY_BSD_TAR]; } + (void)setIsBsdTar:(BOOL)flag { [[NSUserDefaults standardUserDefaults] setBool:flag forKey:PREF_KEY_BSD_TAR]; if (flag == YES) { // on BSD tar also uses -z for extracting .bz archives [_extensionMapping setObject:@"-z" forKey:@"bz2"]; } else { [_extensionMapping setObject:@"-j" forKey:@"bz2"]; } } + (NSString *)zipExecutable; { NSString *zip = [self stringForKey:PREF_KEY_ZIP]; if (zip == nil) { zip = [[NSFileManager defaultManager] locateExecutable:@"unzip"]; } return zip; } + (void)setZipExecutable:(NSString *)newZip { if (newZip != nil) { [[NSUserDefaults standardUserDefaults] setObject:newZip forKey:PREF_KEY_ZIP]; } } + (NSString *)sevenZipExecutable; { NSString *zip = [self stringForKey:PREF_KEY_SEVEN_ZIP]; if (zip == nil) { zip = [[NSFileManager defaultManager] locateExecutable:@"7z"]; // corner case: only 7za may be available on the system if (zip == nil) { zip = [[NSFileManager defaultManager] locateExecutable:@"7za"]; } } return zip; } + (void)setSevenZipExecutable:(NSString *)new7zip { if (new7zip != nil) { [[NSUserDefaults standardUserDefaults] setObject:new7zip forKey:PREF_KEY_SEVEN_ZIP]; } } + (NSString *)rarExecutable; { NSString *rar = [self stringForKey:PREF_KEY_RAR]; if (rar == nil) { rar = [[NSFileManager defaultManager] locateExecutable:@"rar"]; } return rar; } + (void)setRarExecutable:(NSString *)newRar; { if (newRar != nil) { [[NSUserDefaults standardUserDefaults] setObject:newRar forKey:PREF_KEY_RAR]; } } + (NSString *)lhaExecutable { NSString *lha = [self stringForKey:PREF_KEY_LHA]; if (lha == nil) { lha = [[NSFileManager defaultManager] locateExecutable:@"lha"]; } return lha; } + (void)setLhaExecutable:(NSString *)newLha; { if (newLha != nil) { [[NSUserDefaults standardUserDefaults] setObject:newLha forKey:PREF_KEY_LHA]; } } + (NSString *)lzxExecutable { NSString *lzx = [self stringForKey:PREF_KEY_LZX]; if (lzx == nil) { lzx = [[NSFileManager defaultManager] locateExecutable:@"unlzx"]; } return lzx; } + (void)setLzxExecutable:(NSString *)newLzx; { if (newLzx != nil) { [[NSUserDefaults standardUserDefaults] setObject:newLzx forKey:PREF_KEY_LZX]; } } + (NSString *)gzipExecutable { NSString *gzip = [self stringForKey:PREF_KEY_GZIP]; if (gzip == nil) { gzip = [[NSFileManager defaultManager] locateExecutable:@"gzip"]; } return gzip; } + (void)setGzipExecutable:(NSString *)newGzip { if (newGzip != nil) { [[NSUserDefaults standardUserDefaults] setObject:newGzip forKey:PREF_KEY_GZIP]; } } + (NSString *)lastOpenDirectory { return [self stringForKey:PREF_KEY_OPEN_DIR]; } + (void)setLastOpenDirectory:(NSString *)path; { [[NSUserDefaults standardUserDefaults] setObject:path forKey:PREF_KEY_OPEN_DIR]; } + (NSString *)lastExtractDirectory; { return [self stringForKey:PREF_KEY_EXTRACT_DIR]; } + (void)setLastExtractDirectory:(NSString *)path; { [[NSUserDefaults standardUserDefaults] setObject:path forKey:PREF_KEY_EXTRACT_DIR]; } + (NSString *)compressionArgumentForFile:(NSString *)fileName { if (fileName != nil) { return [_extensionMapping objectForKey:[fileName pathExtension]]; } return nil; } /** * Returns the name of the app that will be used to open files that don't have a * pathExtension. */ + (NSString *)defaultOpenApp; { return [self stringForKey:PREF_KEY_DEFAULT_OPEN_APP]; } + (void)setDefaultOpenApp:(NSString *)path; { [[NSUserDefaults standardUserDefaults] setObject:path forKey:PREF_KEY_DEFAULT_OPEN_APP]; } + (void)save { [[NSUserDefaults standardUserDefaults] synchronize]; } //------------------------------------------------------------------------------ // private API //------------------------------------------------------------------------------ + (NSString *)stringForKey:(NSString *)key; { NSString *value; if (_replacementPrefs != nil) { return [_replacementPrefs objectForKey:key]; } value = [[NSUserDefaults standardUserDefaults] stringForKey:key]; if ((value == nil) && (_plistPrefs != nil)) { value = [_plistPrefs objectForKey:key]; } return value; } + (BOOL)boolForKey:(NSString *)key { if (_replacementPrefs != nil) { NSString *value = [_replacementPrefs objectForKey:key]; return [value isEqual:@"YES"]; } return [[NSUserDefaults standardUserDefaults] boolForKey:key]; } @end Zipper/.cdtproject0000644000175000017500000000322410745235357013151 0ustar dirkdirk make clean true true make true true Zipper/NSFileManager+Custom.h0000644000175000017500000000034710745235357015044 0ustar dirkdirk#import @interface NSFileManager (Custom) - (NSString *)locateExecutable:(NSString *)aFilename; - (NSString *)createTemporaryDirectory; - (void)createDirectoryPathWithParents:(NSString *)aPath; @end Zipper/ZipperInfo.plist0000644000175000017500000000435410763456727014164 0ustar dirkdirk{ ApplicationDescription = "GUI for various compressed file formats"; ApplicationName = "Zipper"; ApplicationRelease = "1.3"; ApplicationURL = "http://xanthippe.dyndns.org/Zipper/"; NSIcon = "zipper.tiff"; Authors = ("Dirk Olmes "); Copyright = ""; CopyrightDescription = "Do with Zipper what you like and don't bother me with licensing issues."; NSTypes = ( { NSName = "Zip"; NSHumanReadableName = "Zip Archive"; NSUnixExtensions = ( "zip", "ZIP", "jar", "JAR", "ear", "EAR" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "7Zip"; NSHumanReadableName = "7Zip Archive"; NSUnixExtensions = ( "7z", "7Z", "7za", "7ZA" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "Tar"; NSHumanReadableName = "Tar Archive"; NSUnixExtensions = ( "tar", "TAR" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "TarGz"; NSHumanReadableName = "Compressed Tar Archive"; NSUnixExtensions = ( "gz", "GZ", "tgz", "TGZ" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "TarBz"; NSHumanReadableName = "Compressed Tar Archive"; NSUnixExtensions = ( "bz2", "BZ2", "tbz2", "TBZ2" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "Rar"; NSHumanReadableName = "Rar Archive"; NSUnixExtensions = ( "rar", "RAR" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "Lha"; NSHumanReadableName = "Lha Archive"; NSUnixExtensions = ( "lha", "LHA" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; }, { NSName = "Lzx"; NSHumanReadableName = "Lzx Archive"; NSUnixExtensions = ( "lzx", "LZX" ); NSIcon = "FileIcon.tiff"; NSDocumentClass = "ZipperDocument"; NSRole = "Editor"; } ); NSServices = ( { NSPortName = "Zipper"; NSMessage = "createZippedTarArchive"; NSSendTypes = (NSFilenamesPboardType); NSMenuItem = { default = "Zipper/Create archive"; }; } ); } Zipper/AppDelegate.h0000644000175000017500000000046210745235357013334 0ustar dirkdirk#import @class NSTableView, Archive, TableViewDataSource; @interface AppDelegate : NSObject { @private // IBOutlet NSTableView *_tableView; // NSString *_filename; // Archive *_archive; // TableViewDataSource *_tableViewDataSource; } - (void)showPreferences:(id)sender; @end Zipper/Preferences.gsmarkup0000644000175000017500000000537310745235357015032 0ustar dirkdirk