While playing around with thumbnails (thanks to Charles Philip Chan for the link!) I came up with the following code:

  file = @"~/GNUstep/Images/TextSystem1.png";
  absolute = [file stringByStandardizingPath];
  NSLog(@"file: %@, absolute: %@", file, absolute);
  absolute = [[NSURL fileURLWithPath: absolute] relativeString];
  digest = [[[[absolute dataUsingEncoding: NSASCIIStringEncoding]
                 md5Digest] hexadecimalRepresentation] lowercaseString];

  NSLog(@"file: %@, absolute: %@, digest %@", file, absolute, digest);
  file = [[[@"~" stringByAppendingPathComponent: @".thumbnails"]
              stringByAppendingPathComponent: @"normal"]
             stringByAppendingPathComponent:
                 [digest stringByAppendingPathExtension: @"png"]];

image = [[NSImage alloc] initByReferencingFile: file];

But this does not give the correct result. According to the specification the URL file name "absolute" should be something like
file:///home/fred/GNUstep/Images/TextSystem1.png


but in GNUStep I do get:
file:/home/fred/GNUstep/Images/TextSystem1.png

When using absoluteString instead of relativeString I get:
file://localhost/home/fred/GNUstep/Images/TextSystem1.png

Again this will result in a different MD5 digest than the one expected by the thumbnail standard, so we wont find the correct file. The question now is, if there is another method to get the required string or if this is a bug in GNUstep, which we should correct.

Cheers
Fred




_______________________________________________ Bug-gnustep mailing list [EMAIL PROTECTED] http://mail.gnu.org/mailman/listinfo/bug-gnustep

Reply via email to