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