A little bit of cleanup.

CQTexperiment
vspader 2008-02-18 03:31:09 +00:00
parent 9414c97c09
commit 8bf061bb14
1 changed files with 11 additions and 8 deletions

View File

@ -59,29 +59,32 @@
- (PathNode *)nodeForPath:(NSString *)path - (PathNode *)nodeForPath:(NSString *)path
{ {
NSString *relativePath = [path stringByReplacingOccurrencesOfString:[[[self rootURL] path] stringByAppendingString:@"/"] withString:@"" options:NSAnchoredSearch range:NSMakeRange(0, [path length])]; NSString *relativePath = [[path stringByReplacingOccurrencesOfString:[[[self rootURL] path] stringByAppendingString:@"/"]
relativePath = [relativePath stringByStandardizingPath]; withString:@""
PathNode *theNode = rootNode; options:NSAnchoredSearch
range:NSMakeRange(0, [path length])
] stringByStandardizingPath];
PathNode *node = rootNode;
NSLog(@"Root | Relative | Path: %@ | %@ | %@",[[self rootURL] path], relativePath, path); NSLog(@"Root | Relative | Path: %@ | %@ | %@",[[self rootURL] path], relativePath, path);
for(NSString *c in [relativePath pathComponents]) for(NSString *c in [relativePath pathComponents])
{ {
NSLog(@"COMPONENT: %@", c); NSLog(@"COMPONENT: %@", c);
BOOL found = NO; BOOL found = NO;
for (PathNode *node in [theNode subpaths]) { for (PathNode *subnode in [node subpaths]) {
if ([[[[node url] path] lastPathComponent] isEqualToString:c]) { if ([[[[subnode url] path] lastPathComponent] isEqualToString:c]) {
theNode = node; node = subnode;
found = YES; found = YES;
} }
} }
if (!found) if (!found)
{ {
NSLog(@"Not found!");
return nil; return nil;
} }
NSLog(@"Component: %@", c);
} }
return theNode; return node;
} }
- (void)pathDidChange:(NSString *)path - (void)pathDidChange:(NSString *)path