582 :(NSString *)path
583{
584 NSString *lastComponent =
nil;
585 NSString *truncatedPath =
nil;
586 NSString *theName =
nil;
587
588 if (path ==
nil) theName = [NSString stringWithFormat:@"%p", self];
589 else
590 {
591 lastComponent = [path lastPathComponent];
592 if (![lastComponent hasPrefix:@"script."]) theName = lastComponent;
593 else
594 {
595 truncatedPath = [path stringByDeletingLastPathComponent];
596 if (NSOrderedSame == [[truncatedPath lastPathComponent] caseInsensitiveCompare:@"Config"])
597 {
598 truncatedPath = [truncatedPath stringByDeletingLastPathComponent];
599 }
600 if (NSOrderedSame == [[truncatedPath pathExtension] caseInsensitiveCompare:@"oxp"])
601 {
602 truncatedPath = [truncatedPath stringByDeletingPathExtension];
603 }
604
605 lastComponent = [truncatedPath lastPathComponent];
606 theName = lastComponent;
607 }
608 }
609
610 if (0 == [theName length]) theName = path;
611
612 return StrippedName([theName stringByAppendingString:
@".anon-script"]);
613}
static NSString * StrippedName(NSString *string)