Changeset 871
- Timestamp:
- 07/03/04 08:56:32 (4 years ago)
- Files:
-
- Footagehead/trunk/FHHTMLHandler.m (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
Footagehead/trunk/FHHTMLHandler.m
r866 r871 1 /* $Id: FHHTMLHandler.m,v 1. 1 2004/06/14 23:36:06morris Exp $ */1 /* $Id: FHHTMLHandler.m,v 1.2 2004/07/03 06:56:32 morris Exp $ */ 2 2 3 3 /* … … 100 100 NSScanner *scanner; 101 101 FHFile *file; 102 BOOL isDirectory; 102 103 103 104 if(_files) … … 130 131 if([scanner scanUpToString:token intoString:NULL]) { 131 132 // --- scan next link 132 [scanner scanString:token intoString:NULL]; 133 [scanner scanUpToCharactersFromSet:tokenSet intoString:&link]; 134 135 // --- is it an image? 136 if(![types containsObject:[link pathExtension]]) 133 if(![scanner scanString:token intoString:NULL]) 137 134 continue; 138 135 139 // --- bump number of images 140 _numberOfImages++; 136 if(![scanner scanUpToCharactersFromSet:tokenSet intoString:&link]) 137 continue; 138 139 if([link hasSuffix:@"/"]) { 140 // --- is it a dir? 141 if([link hasPrefix:@"/"]) 142 continue; 143 144 isDirectory = YES; 145 } else { 146 // --- is it an image? 147 if(![types containsObject:[link pathExtension]]) 148 continue; 149 150 _numberOfImages++; 151 152 isDirectory = NO; 153 } 141 154 142 155 // --- create file 143 156 file = [[FHFile alloc] initWithURL: 144 157 [[NSURL URLWithString:link relativeToURL:[self URL]] absoluteURL] 145 isDirectory: NO];158 isDirectory:isDirectory]; 146 159 [_files addObject:file]; 147 160 [file release]; … … 176 189 177 190 - (NSURL *)parentURL { 178 return [self URL]; 191 NSString *string; 192 NSRange range; 193 194 string = [_url absoluteString]; 195 196 while([string hasSuffix:@"/"]) 197 string = [string substringToIndex:[string length] - 1]; 198 199 range = [string rangeOfString:@"/" options:NSBackwardsSearch]; 200 201 if(range.location == NSNotFound) 202 return [self URL]; 203 204 string = [string substringToIndex:range.location + 1]; 205 206 if([string hasSuffix:@"://"]) 207 return [self URL]; 208 209 return [NSURL URLWithString:string]; 179 210 } 180 211
